AshD
AshD

Reputation: 1154

GWT: Multi Selection model does not update the celltable status in some cases

I am using the GWT MultiSelectionModel within a CellTable in which I have a checkbox in one column and a widget in the other column. I have added handlers to update the selection status based on user clicks. If the user clicks on any part of either columns when the cell is selected, the status gets updated correctly and the cell turns white from light blue. Howvever, If the user clicks on the check box and the cell is selected, the check box gets unchecked but the cell is still blue. Even more strange: This issue does not happen if I have a few breakpoints before the status update code is executed.

In all other cases, the cell state and the checkbox state gets updated correctly. Note that I am not using the ProvidesKeys interface since the object do not change.

Can anyone help me with this? Thanks for your help.

Upvotes: 0

Views: 1126

Answers (2)

Andrea Boscolo
Andrea Boscolo

Reputation: 3048

Have you tried using a CheckBoxCell for your checkbox column and, specifically, the CheckboxCell(boolean dependsOnSelection, boolean handlesSelection) constructor (by passing true to both params)?

Upvotes: 1

dongxu
dongxu

Reputation: 151

I've got almost the same problem when I use MultiSelectionModel. What's my walkaround is to see the checkbox's column as a special one and then to deal with it manually. Say:

myDataGrid.addCellPreviewHandler(
  @Override
  public void onCellPreview(final CellPreviewEvent<MyCellData> event){
    if("click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn()){
      doWhatYouWant();
    }
  }
)

Upvotes: 0

Related Questions