SmartGWT has this property for a TreeGrid object:
employeeTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
This by default 'prepends' every nodes (including root) with checkbox. (Just making myself clear.)
Also, I am aware of this similar solved question: GWT tree with checkbox:How to get all checked tree items?
However, I do not seek this kind of solution.. What I'm looking for is a more efficient way, where I don't have to loop through 1000 items.
Is there any way to do this, if possible, using the widget I am using now? If not, is there any other way, using other widget?
Thank you very much!
I think as you use SelectionAppearance.CHECKBOX
you tell to the grid that the selected records are marked by the checkbox field value. So every time you check one you select a record.
You can get the set of selected records by either getSelection()
method or getSelectedRecords(boolean)
because of deprecation of the previuous one.
You can have a look at the code of this example of the smartgwt showcase.