本文介绍了GWT CellTable选择并单击CheckBoxCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CellTable,它可以与SingleSelectionModel一起工作,进行单一选择并在细节面板中显示一些信息。还有,我已将CheckBoxCell列放入此CellTable中,它与另一个MultipleSelectionModel一起进行批量删除操作。



当我尝试点击CheckBoxCell列中的复选框时,GWT选择行并在第二次点击复选框后更改复选框状态。所以我们应该做两次点击,但我需要做到这一点(改变复选框状态)只需点击一下。



我尝试了不同的方法来修复它:




  • 更改dependsOnSelection并将选择参数更改为CheckboxCell

  • 更改CellTable中的SelectionEventManager(DefaultSelectionEventManager.createCheckboxManager(),DefaultSelectionEventManager.createCustomManager)



但它不起作用。

我发现类似的问题互联网,但他们都使用一个MultipleSelectionModel。这与我想要的不一样,因为有详细信息面板(所以我只能做单选)。

任何人都可以帮我弄清楚如何解决它吗?

/ b>

UPD:
我刚刚删除了SingleSelectionModel,并重新设计了UI以使用MultipleSelectionModel。它是GWT-hell ..试试切换你的选择模型:使用 MultiSelectionModel c $ c>作为 CellTable 的选择模型,以便复选框按预期工作(使用 dependsOnSelection 和 handlesSelection 设置为 true ),对于主控细节功能,使用 CellPreviewEvent。 Handler (或 DefaultSelectionEventManager#createCustomManager )和 RowStyles 和用于渲染( RowStyles )的getRowElement + addStyleName / removeStyleName code> CellTable 呈现行,然后 getRowElement 来动态更新样式)。


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

解决方案

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

这篇关于GWT CellTable选择并单击CheckBoxCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 08:47