Tuesday, April 26, 2011

Re: GWT 2.2 - SingleSelectionModel and CellTable behavior issue

Never mind - I needed to set a key provider. Selection works as
expected now.

On Apr 26, 11:53 am, John Bates <johntba...@gmail.com> wrote:
> Hi, all.
>
> I've encountered some odd behavior when using a SingleSelectionModel
> with a CellTable: when the user clicks a cell in the table, my
> onSelectionChange callback reports the correct selected object, but
> the CellTable widget appears to have all rows selected, as opposed to
> just the row corresponding to the selected object.  I initialize the
> table as follows:
>
> ...
>
> // set the data provider
> dataProvider.addDataDisplay(table);
>
> // add a selection model
> final SingleSelectionModel<Sample> selectionModel = new
> SingleSelectionModel<Sample>();
> selectionModel.addSelectionChangeHandler(new
> SelectionChangeEvent.Handler() {
>         @Override
>         public void onSelectionChange(SelectionChangeEvent event) {
>                 Sample selected = (Sample) selectionModel.getSelectedObject();
>                 if(selected != null) {
>                         GWT.log("You have selected: " + selected.getExperimentId() + " " +
> selected.getSampleId());
>                 }
>         }
>
> });
>
> table.setSelectionModel(selectionModel);
>
> ...
>
> Any ideas as to what might be wrong?
>
> Thanks in advance for your help!
> -John Bates

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment