Select and edit multiple rows
With Justinmind, you can select multiple rows in a Data List and perform operations. With our example, you can change the status to On Time/Late when the check box is selected next to a data field.
To select multiple rows in your Data List, follow these steps:
- Go to the Data Masters palette and create a new Data Master. Name it “Flights” and create three fields: Airline, Departing, and Status.
- Double-click on the Data Master you’ve just created and select the tab “View and edit records”. Write some example data there.
- Now drag a Data List widget to the screen. Name it “Flights” and select the Data Master you just created.
- Right click on the Data List and select “New column”. Drag a Check Box inside the new column.
- Drag two Buttons to the Canvas. Name one “Late” and the other “On Time”.
- Select the “Late” button, go to the Events palette and add an “On Click” + “Data Master Action – Modify” event. You’ll see the Calculated Expression builder appear. Follow these steps to create the expression:
1. Drag the ‘Filter’ function next to the ‘Modify’ icon.
2. In the first open space that appears, drag the whole Data List from the expression Canvas.
3. Drag the Check box (it’s easier to drag it from the outline) into the next open space.
4. Finally, type in “Late” in the ‘Status’ open space value.
This expression will change the status to ‘Late’ for all the Flights in the Data List that have the check box checked.
- Now select the “On Time” button, and follow the same steps above, but this time type in “On Time” in the ‘Status’ open space value in the expression.
- Additionally, you can add a Check box to the header of the first column to add a “Select all” option. With that check box selected, add an “On Click” + “Set Value” event, selecting the check box in Current_row_1 as the target of the action. For the value, click the ‘Calculated’ radio button, and the ‘Add expression’ text. You’ll see the Calculated Expression builder appear. Drag the header check box into the open space in the expression.
Click “Simulate” to interact with your prototype.
You can download our example here.