开发者

I want my CheckboxCell to control the selected state of each row

I've got a CellTable with a column rendered with a CheckboxCell. I want to check the boxes to select the rows.

The default behavior with CheckboxCell(false, false) is tantalizingly close to my goal - selecting a row checks the checkbox, and de-selecting a row开发者_开发百科 unchecks the checkbox. However, if I click a checkbox, it unselects any already-selected rows. Even worse, when I uncheck a checkbox, the row is not deselected. Argh!

I'm looking at coding my own cell now (or messing with the SelectionModel?), but this seems like behavior Google might have been trying for. I've tried every permutation of values in the constructor, to no avail. Is there a simple override I can add to finally make my dream... a reality?


You know how you can search for 30 minutes, and then 20 seconds after you post your question you find your answer?

Well, it turns out that to unleash the power of the CheckboxCell, you need to pass a Handler that is equipped to deal with the complexities of the situation. Try

setSelectionModel(selectionModel, DefaultSelectionEventManager.<T> createCheckboxManager()); 

with your MultiSelectionModel selectionModel - the selectionModel itself is not enough!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜