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).
GWT Customize CellList Multi-Selection Model for Mobile Devices
Asked Answered
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.
Thanks for the info, I needed to use a CellList, so I brewed up the multi-selection functionality I needed from a SingleSelectionHandler. –
Bigeye
Hey napo, I'm looking to implement toggle-on-click functionality with a CellList (not CellTable) also, can you share your solution? –
Jarry
Just adding an extra checkbox column would be a more user friendly solution.
© 2022 - 2024 — McMap. All rights reserved.