private CheckBox selectAllCheckBox;
private boolean userSelectionAllowed = true;
private boolean enabled = true;
+ private HandlerRegistration headerClickHandler;
SelectionColumn(final Renderer<Boolean> selectColumnRenderer) {
super(selectColumnRenderer);
});
selectAllCheckBox.setValue(selected);
- addHeaderClickHandler(new HeaderClickHandler() {
+ headerClickHandler = addHeaderClickHandler(new HeaderClickHandler() {
@Override
public void onClick(GridClickEvent event) {
if (!userSelectionAllowed) {
getEscalator().getBody().refreshRows(0,
getEscalator().getBody().getRowCount());
}
+
+ public void cleanup() {
+ if (headerClickHandler != null) {
+ headerClickHandler.removeHandler();
+ headerClickHandler = null;
+ }
+ }
}
/**
return;
}
+ if (this.selectionColumn != null) {
+ selectionColumn.cleanup();
+ }
+
if (this.selectColumnRenderer != null) {
if (this.selectColumnRenderer instanceof ComplexRenderer) {
// End of Life for the old selection column renderer.
assertEquals("clicked", button.getText().toLowerCase());
}
+ @Test
+ public void testSortAfterMultiSelect() throws Exception {
+ openTestURL();
+
+ selectMenuPath("Component", "Columns", "Column 0", "Sortable");
+ selectMenuPath("Component", "Header", "Append row");
+ selectMenuPath("Component", "Header", "Row 2", "Set widget");
+ selectMenuPath("Component", "State", "Selection mode", "multi");
+ selectMenuPath("Component", "State", "Selection mode", "single");
+
+ GridCellElement headerCell = getGridElement().getHeaderCell(0, 0);
+
+ headerCell.click();
+
+ assertTrue(hasClassName(headerCell, "sort-asc"));
+ }
+
private void assertHeaderCount(int count) {
assertEquals("header count", count, getGridElement().getHeaderCount());
}