Dynamic table - Entering and saving data

0
I'm working on creating an hour registration app, which requires you to provide how many hours you worked on what projects throughout the month. The idea is to create a table wherein an employee can enter his hours. The x-axis (left to right) has all the days. The y-axis (top to bottom) has all the projects. This results in a table of the size "days-per-month" x "number-of-projects". Using a save button, these hours are written to the database, and your hours for the month are saved. Furthermore, using an "Add" button, you should be able to add a row to add another project to your table. In essence, I'd like a dynamic table. See also the example below for the general idea of the table. Enter Mendix: As far as I've seen, Mendix contains a simple table function with a limited possible number of rows/columns, which is not what I need. I've tried a couple of ways to get this done, but those ways didn't lead me anywhere close to the solution I described. This leaves me with two questions: - Is there a functionality within the table widget (or other widgets) that I somehow missed, which would make this possible? - If not, do you have any pointers on how this could be realized using micro-flows?
asked
1 answers
6

Hello Stefan,

I would recommend using a listview widget with the editability property turned on. You could begin by adding a dataview of your TimeSheet object to the page. Then place a listview within the dataview that retrieves the TimeSheetLineItems over an association to the timesheet. You can then add any editable fields into the list view using text input widgets.

To add a row to the table, create a button that calls a microflow with the TimeSheet as an input parameter. Create a new obejct of TimeSheetLineItem in the microflow. Set an association from the TimeSheetLineItem to the TimeSheet and refresh the object in the client.

The best option will depend on the specifics of your domain model, but I hope this can give you a good start.

answered