Disable click handler on specific cells in GWT CellTable

978 views Asked by At

I'm writing a webapp with GWT for the first time. The app includes a grid with rows that, when clicked, will show a more detailed description of the row's contents. I managed to add the click handler into the table, but some columns had dropdowns or checkboxes, and now when I try to click those elements, the click handler overrides them. I need to know if I can selectively disable the click handler for those types of elements. My code is below:

public void onCellPreview(CellPreviewEvent event)
        {
            if(event.getNativeEvent().getType().contains("click")){
                String[] test = { "test", "test2", "test3", "test4", "test5" };
                EditDialog popup = new EditDialog(Table.this, test);
                popup.show();
            }

        }
    });
1

There are 1 answers

4
Andrei Volgin On BEST ANSWER

Try:

if(event.getNativeEvent().getType().contains("click")){
    // if you don't need this event)
    event.setCanceled(true);
    // otherwise continue
    ...
}