Selecting 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.
- Then click “OK”.
- Double-click on the Data Master you’ve just created and select the tab “View and edit records”.
- Write some example data there.
- Then click “OK”.
- Now drag a Data List widget to the screen.
- Name it “Flights” and select the Data Master.
- Then select all the fields.
- Right click on the Data List and select “New column”.
- Then select the newly created column (move the mouse to the top of the column) and drag it to the left most of the Data List.
- Drag a Check Box inside the new column.
- Drag two Buttons (to match our example).
- Select the “Late” button, go to the Events palette and add an “On Click” + “Data Master Action”.
- Select the “Modify” button under the “Flights” Data Master and build the expression displayed in the image below, by dragging – in this order – the “Filter” function, the whole Data List and the Check box (it’s easier to drag it from the outline.
- Remember to select “is checked” in the drop-down menu that will appear below it in the expression builder).
- Finally, write “Late” in the Status value:
- This expression will change the status to ‘Late’ to all the Flights in the Data List that have the check box checked.
- Click “OK” twice.
- Now select the “On Time” button, and follow the same steps as in the other button but this time write “On Time” in the status value in the expression builder.
- In addition you can add a Check box to the header of the first column to add a “Select all” option.
- You will only have to select the Check box in the first row, go to the events tab and add an “On Click” + “Set Value” event.
- In the Events dialog, select the check box in the cell as the component that will display the value, and click the “Calculate” button to open the expression builder.
- In the expression, just drag the Check box that you’ve added in the header and click “OK” twice.
- Remember that it’s much simpler and quicker to select the check boxes from the outline when in the events dialog.
That’s all. Click “Simulate” to interact with your prototype.
You can download our example here.