GWT CellTable selection and single click on CheckBoxCell

假装没事ソ 提交于 2019-12-04 14:05:04

问题


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:


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).



来源:https://stackoverflow.com/questions/11063273/gwt-celltable-selection-and-single-click-on-checkboxcell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!