Hello everyone.
I'm currently migrating from gwt-ext to smartgwt that looks great and responds to lot of my requirements.
I currently a problem with check boxes inside listgrids.
I would like an CellChangedEvent to be fired when the user changes the value. I don't want the user to have to enter edit mode, change the value then exit the edit mode so the event can be fired. It's against UI best practice. Currently i have not manage to get this behavior.
I tried lot of combination between setEditEvent (CLICK or Not), ListGridField.setCanToggle, ListGrid.CanEdit, etc.
The behavior I'm looking for is "when i click on a checkbox, whether or not the row is selected, the event is just fired (onCellChanged would be fine)".
Or maybe i'm missing something?
Some of my code :
I'm currently migrating from gwt-ext to smartgwt that looks great and responds to lot of my requirements.
I currently a problem with check boxes inside listgrids.
I would like an CellChangedEvent to be fired when the user changes the value. I don't want the user to have to enter edit mode, change the value then exit the edit mode so the event can be fired. It's against UI best practice. Currently i have not manage to get this behavior.
I tried lot of combination between setEditEvent (CLICK or Not), ListGridField.setCanToggle, ListGrid.CanEdit, etc.
The behavior I'm looking for is "when i click on a checkbox, whether or not the row is selected, the event is just fired (onCellChanged would be fine)".
Or maybe i'm missing something?
Some of my code :
Code:
ListGrid declaration : setSelectionType(SelectionStyle.SINGLE); setAlternateRecordStyles(true); setAutoFetchData(true); setShowAllRecords(true); setCanHover(false); setCanReorderFields(false); setCanEdit(true); setHeaderBarStyle("headerCell"); setShowHeaderMenuButton(false); setShowHeaderContextMenu(false); setWrapCells(false); setEditOnFocus(true); setEditEvent(ListGridEditEvent.CLICK); setEditByCell(true); setFields(getTableFields()); private ListGridField[] getTableFields() { ArrayList<SheetColumnDescriptorVO> columnDescriptors = sheetVO.getColumnDescriptors(); ListGridField[] fields = new ListGridField[columnDescriptors.size()]; for (int i = 0; i < columnDescriptors.size(); i++) fields[i] = getTableField(columnDescriptors.get(i)); return fields; } private ListGridField getTableField(SheetColumnDescriptorVO descriptor) { ListGridField field = new ListGridField(descriptor.getId(), descriptor.getName() != null && !descriptor.getName().trim().equals("") ? descriptor.getName() : "_"); field.setAlign(Alignment.LEFT); field.setCanFilter(false); field.setCanGroupBy(false); field.setCanSort(false); field.setCanEdit(descriptor.isEditable()); switch (desc.getType()){ [....] case : Util.TYPE_BOOLEAN { field.setType(ListGridFieldType.BOOLEAN); field.setAlign(Alignment.CENTER); field.setCanToggle(true); break; } [....] return field; }
Comment