Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ListGrid with preloaded checkboxes

$
0
0
SmartClient Version: v8.3p_2013-02-02/LGPL
gwt 2.3

I have a ListGrid with state loaded from the database, I used:
Code:

newListGrid.setSelectionType(SelectionStyle.SIMPLE);
newListGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);

Users select or deselect one or more checkboxes and save their changes.
I tried SelectionUpdatedHandler, but I don't see a way to access records that have changed - only records that are selected and I need both.
I tried a SelectionChangedHandler, it allows me to collect only the records that are changed, but it fires twice and resets the record back to its original state (I can't just collect the records and flip the state - it won't catch a checkbox clicked multiple times).

Code:

class FilterSelectionChangedHandler implements SelectionChangedHandler {

      ...
          AlertFilterListGridRecord aflgr = (AlertFilterListGridRecord)event.getRecord();
          aflgr.setAttribute(CHECK_VALUE, event.getState());
            editedRecords.add(aflgr);
        }
    }

I saw a thread with a reply about using mouse up - but I've been using gwt/smartGWT for a couple of weeks and can't figure out how that's supposed to work, do I nest a mouse up handler in the SelectionChangedHandler?

Failing that, is there any other way to get the checkbox state? Right now I'm using ListGrid.getSelected, then removing selected and whatever's left isn't selected, but there has got to be a better way.

Thanks in advance

Viewing all articles
Browse latest Browse all 4756

Trending Articles