Edit attribute on button click

Hi,

So what I need is a button, which is set the selected row’s isActual attribute to true.
Here is my code which should be supplement:


public void setActualTrue(Component source) {
    	MyEntity me = myEntitysTable.getSingleSelected();
        if (me != null) {
            me.isActual(true);
            // commit somehow
            myEntitysDs.refresh(); 
        } else {
            showNotification("Please select a row!", NotificationType.HUMANIZED);
        }
    }

What am I missed? How to ‘commit’ my setter?
What is the process if I want to select more than one row and on button click set the all selected row’s isActual to true? I know about getSelected() function, but do not know how to use it.

Thank you so much!

Hi,
To commit changes invoke the myEntitysDs.commit() method.
The getSelected() method returns instances of the entities corresponding to the selected rows of the table. Iterate through all selected entities and change the certain value. After that call the datasource commit() method.
Regards,
Gleb

1 Like