On 15 sep, 19:34, chiappone <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to