check box in a table

How to have check boxes for each row in a table and have multiselect option for the check boxes. Also need to know how to get the object of the checked row. Would be great if sum1 can provide samples


You could use a
generated column
for the CheckBoxes, and then store the item ID associated with that checkbox using the setData(Object) method. Then add a value change listener for each check box, and process the selections there (store the selection array as a variable somewhere).


Here’s an example I posted recently
of using a generated checkbox to keep track of selected items, in the way that Jouni suggests. I didn’t use #setData - but it appears to work fine.