setStylePrimaryName("ui-table");
table.setStylePrimaryName("ui-table");
table.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Cell eventCell = table.getCellForEvent(event);
if(eventCell == null)
return;
int row = eventCell.getRowIndex();
Element currentEventTarget = event.getNativeEvent().getCurrentEventTarget().cast();
for(Element elt = event.getNativeEvent().getEventTarget().cast();
elt != currentEventTarget && elt != getElement() && elt != null;
elt = DOM.getParent(elt)) {
if(elt.getTagName().equalsIgnoreCase("td") && elt == table.getCellFormatter().getElement(row, eventCell.getCellIndex()))
break;
if(elt.getTagName().equalsIgnoreCase("tr") && elt == table.getRowFormatter().getElement(row))
break;
if((DOM.getEventsSunk(elt) & (Event.ONCLICK|Event.ONCONTEXTMENU|Event.ONMOUSEDOWN|Event.ONMOUSEUP)) != 0) {
// Ignore this event since it should be handled by the other element