How to set value to a editable table column

I have a browser screen having a editable column of a groupTable with cuba platform 7.2, which allow user to change status between Y/N.
But I want to able to set this editable column to Y/N for all listed records by a “Select All”/“Select None” button without using the system bulk edit function. How can I do it by programming button.
Thanks.

Hi,
Data binding in CUBA UI works in both directions.
If you have some entities displayed in the table - you can change values directly in the entity, and the values in the table will be refreshed automatically.

So, inject the GroupTable component to the screen controller.
Use GroupTable#getSelected() to obtain set of selected items. Assign value to entities.

Use GroupTable.setSelected() to implement “select all / none” actions.

1 Like

Thanks a lot.
Now I can use the following command to select all/none.
myTable.selectAll(); //Select All
myTables.etSelected(Collections.emptyList()); //select None

For single record selected I can set values like this.
myTable.getSingleSelected().setPaid(true);
But after Select All, how can I set multi selected “Paid” field to ture?

Thanks.

for (MyEntity entity: myTable.getSelected()) {
 entity.setPaid(true);
}
1 Like