GWT CellTable selection and single click on CheckB

2019-03-21 02:11发布

I've got a CellTable wich work with SingleSelectionModel to make single selection and show some information into details panel. Also I've got CheckBoxCell column into this CellTable which work with another MultipleSelectionModel to make mass delete operation.

When I try to click on check box in CheckBoxCell column GWT selects row and after second click on checkbox it change checkbox state. So we should make two clicks, but I need to do it (change checkbox state) by one click.

I tried different ways to fix it:

  • Change dependsOnSelection and handlesSelection parameters into CheckboxCell
  • Change SelectionEventManager in CellTable (DefaultSelectionEventManager.createCheckboxManager(), DefaultSelectionEventManager.createCustomManager)

But it doesn't work.

I found similar problems into Internet but all of them work with one MultipleSelectionModel. It's not the same what I want, because there's details panel (So I could make only single selection).

Can anyone help me to figure out how to resolve it?

UPD: I've just removed SingleSelectionModel and redesigned UI to working with MultipleSelectionModel. It's GWT-hell..

1条回答
家丑人穷心不美
2楼-- · 2019-03-21 02:45

Try to switch your selection models: use the MultiSelectionModel as the CellTable's selection model, so that the checkboxes work as expected (with both dependsOnSelection and handlesSelection set to true), and for the master-detail feature, use a CellPreviewEvent.Handler (or DefaultSelectionEventManager#createCustomManager), and RowStyles and getRowElement+addStyleName/removeStyleName for rendering (RowStyles when the CellTable renders the rows, then getRowElement to dynamically update styling).

查看更多
登录 后发表回答