I have a grid like this one . The default behavior of this widget is to sort the column when clicking on the header. I want to disable that, and leave only the options in the context menu.
grid.addHeaderClickHandler(new HeaderClickHandler() {
@Override
public void onHeaderClick(HeaderClickEvent event) {
event.getEvent().cancelBubble(true);
event.getEvent().preventDefault();
event.getEvent().stopPropagation();
Window.alert("Event caught");
}
});
The alert gets displayed before the sorting. But when clicking Ok
the default behavior kicks in.
Do you have any suggestions on how to accomplish this?
Ok I found it
grid.getView().setSortingEnabled(false);
. This will disable the sorting when clicking on the header, but keep the menu items in place.