GWT Customize CellList Multi-Selection Model for Mobile Devices

坚强是说给别人听的谎言 提交于 2019-12-10 11:08:26

问题


I have an application, that uses the MultiSelectionModel, and it works great, but I need the site I'm developing to work on mobile devices, and so I can't use the keyboard to assist in selecting the elements (since it doesn't exist). EX: On the desktop I just hold ctrl and click on all the element that I want to select.

So on the mobile device, I would like to modify the default behavior of the MultiSelectionModel so that when you click on a CellList item, it toggles the selection state of that item.

I have looked through the source for it and cannot see anyway to implement the behavior that I need. (Mobile MultiSelection).


回答1:


Whether you add a checkbox column or not, you'll have to add a cell preview handler. The easiest way to define one is to use DefaultSelectionEventManager, either using a checkbox manager in combination with a checkbox column, or creating a custom one (you'd map a click event into a toggle action).

You can see it used, the checkbox variant, in the GWT Showcase; it uses the setSelectionModel overload with two arguments to add the CellPreviewEvent.Handler at the same time.




回答2:


Just adding an extra checkbox column would be a more user friendly solution.



来源:https://stackoverflow.com/questions/6847863/gwt-customize-celllist-multi-selection-model-for-mobile-devices

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