avoid row selection on cell click in CellTable

2,139 views
Skip to first unread message

Torgeir

unread,
Feb 1, 2011, 7:39:04 AM2/1/11
to google-we...@googlegroups.com
I have a CellTable with a MultiSelectionModel, and a selection checkbox in the first column, just as the CellTree sample in the GWT ShowCase. I have a problem in that when clicking on a cell in the table, eg a Cell of type SafeHtmlCell, the row is selected.

I have tries using a different Column instance, and a different Cell instance, in order to avoid this selection, but nothing seems to work. Is there a way to only allow row selection through selecting items in the selection column?

John LaBanca

unread,
Feb 1, 2011, 10:53:02 AM2/1/11
to google-we...@googlegroups.com
Selection is controlled by the selectionEventManager, which is is a CellPreviewEventHandler.  Use the following to limit selection to checkboxes:

DefaultSelectionEventManager selectionEventManager = DefaultSelectionEventManager.createCheckboxManager(0); // Limit selection to checkboxes in column 0.
cellTable.setSelectionModel(myMultiSelectionModel, selectionEventManager);

Thanks,
John LaBanca
jlab...@google.com


On Tue, Feb 1, 2011 at 7:39 AM, Torgeir <torgei...@gmail.com> wrote:
I have a CellTable with a MultiSelectionModel, and a selection checkbox in the first column, just as the CellTree sample in the GWT ShowCase. I have a problem in that when clicking on a cell in the table, eg a Cell of type SafeHtmlCell, the row is selected.

I have tries using a different Column instance, and a different Cell instance, in order to avoid this selection, but nothing seems to work. Is there a way to only allow row selection through selecting items in the selection column?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Torgeir

unread,
Feb 1, 2011, 11:37:01 PM2/1/11
to google-we...@googlegroups.com
Thx, I also just found that simply having my Cells implementing the handlesSelection method fixes it;

@Override public boolean handlesSelection() { return true; }

David Sanders

unread,
Oct 5, 2011, 5:24:30 AM10/5/11
to google-we...@googlegroups.com
Thanks John!  -  I was looking to do something similar with a file download cell that I didn't want triggering selection events but pulled my hair out trying to find out how to disable the selection. Your suggestion worked a treat - I used the blacklist method.
Reply all
Reply to author
Forward
0 new messages