Wednesday, September 15, 2010

Re: How to handle celltable selection events?

It seems like that would only work when a specific cell is clicked
rather then a celltable row?

On Sep 15, 11:46 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On 15 sep, 19:34, chiappone <chiapp...@gmail.com> wrote:
>
>
>
>
>
> > I am using M3 and want to be able to click on a row of my table and be
> > able to listen for that event.
>
> > I have the following which works fine:
>
> > private SingleSelectionModel<DeviceInfo> setSelectionModel(
> >                         CellTable<DeviceInfo> cellTable) {
> >                 final SingleSelectionModel<DeviceInfo> selectionModel = new
> > SingleSelectionModel<DeviceInfo>();
>
> >                 Handler selectionHandler = new SelectionChangeEvent.Handler() {
>
> >                         @Override
> >                         public void onSelectionChange(
> >                                         com.google.gwt.view.client.SelectionChangeEvent event) {
> >                                 // User user = selectionModel.getSelectedObject();
> >                                 dispatcher.execute(
> >                                                 getRealtimeAction(DEVICE_CHANNEL, selectionModel
> >                                                                 .getSelectedObject().getDeviceId()),
> >                                                 new ActionCallback<RealtimeResult>() {
>
> >                                                         @Override
> >                                                         public void onFailure(Throwable caught) {
> >                                                                 // do nothing
> >                                                         }
>
> >                                                         @Override
> >                                                         public void onSuccess(RealtimeResult result) {
> >                                                                 // GWT.log("POSTED REALTIME");
> >                                                         }
>
> >                                                 });
>
> >                                 DisplayMessageEvent.fireMessage(eventBus, "Loading...");
>
> >                         }
>
> >                 };
>
> >                 selectionModel.addSelectionChangeHandler(selectionHandler);
> >                 // cellTable.setSelectionEnabled(true);
> >                 cellTable.setSelectionModel(selectionModel);
>
> >                 return selectionModel;
> >         }
>
> > The problem with this is that if the row is already selected you
> > cannot select it again.  I want to fire the event not only
> > onSelectionChange but just Selection.  Thanks.
>
> Then you probably should use something like ClickableTextCell, rather
> than relying on selection.

--
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