Hi,
I have some selected records in a grouped ListGrid. When clicking Ungroup in the header, the selection is gone.
In the target application, I only have a checkbox style, and not a "record row selected" style. In my application, the checkboxes remain checked, while the underlying call to getSelectedRecords() does not return them.
This does not happen in the following standalone repro case. I assume it's because we are tinkering with redraw behavior. But if the following is a bug and is fixed, this won't be a problem for my application anymore.
Repro:
* click 'add data'
* open group 1 to verify something is selected
* click 'check selection'
OK, selected record info is shown
* in the grid header, column a, click "ungroup"
<= all selected rows are gone
* click 'check selection'
NOK, no more selected records
Build v8.3p_2012-11-30/Pro Deployment (built 2012-11-30)
I have some selected records in a grouped ListGrid. When clicking Ungroup in the header, the selection is gone.
In the target application, I only have a checkbox style, and not a "record row selected" style. In my application, the checkboxes remain checked, while the underlying call to getSelectedRecords() does not return them.
This does not happen in the following standalone repro case. I assume it's because we are tinkering with redraw behavior. But if the following is a bug and is fixed, this won't be a problem for my application anymore.
Repro:
* click 'add data'
* open group 1 to verify something is selected
* click 'check selection'
OK, selected record info is shown
* in the grid header, column a, click "ungroup"
<= all selected rows are gone
* click 'check selection'
NOK, no more selected records
Code:
final HTMLFlow infoPane = new HTMLFlow("Selection?"); final String GROUP_FIELD = "_group"; final String SELECTED_FIELD = "_selected"; final ListGrid grid = new ListGrid(); grid.setSelectionProperty(SELECTED_FIELD); grid.setGroupByField(GROUP_FIELD); grid.setGroupStartOpen(GroupStartOpen.NONE); grid.setSelectionAppearance(SelectionAppearance.CHECKBOX); grid.setSelectionType(SelectionStyle.SIMPLE); ListGridField field1 = new ListGridField("a"); ListGridField field2 = new ListGridField("b"); ListGridField field3 = new ListGridField(GROUP_FIELD); grid.setFields(field1, field2, field3); Button addData = new Button("Add data to grid"); addData.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord [] data = new ListGridRecord[20]; for (int i=0; i<data.length; i++) { data[i] = new ListGridRecord(); data[i].setAttribute("a", i); data[i].setAttribute("b", "this is b " + i); data[i].setAttribute(SELECTED_FIELD, i%3 != 0); data[i].setAttribute(GROUP_FIELD, i%3); } grid.setData(data); } }); Button checkSelection = new Button("Check Selection"); checkSelection.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { StringBuilder info = new StringBuilder(); ListGridRecord [] records = grid.getSelectedRecords(); for (ListGridRecord r : records) { info.append(r.getAttribute("a")); info.append("<br/>"); } infoPane.setContents(info.toString()); } }); VLayout layout = new VLayout(); layout.setMembers(grid, addData, checkSelection, infoPane);
Comment