Search code examples
gwtgwt2gwt-2.2-celltablegwt-2.2gwt-2.3

GWT CellTable Sort Column With Custom Header


I have a sortable column in a CellTable. The problem is that I have a custom Header, in the header there is a text box. When the user clicks the text box, the column is sorted and the text box looses focus. What I need is for the sort to happen if there is a click anywhere in the header except in the text box. I have tried listening to the "click" event on the textbox cell and do stopPropagation, but the event is fired after the sort happens so it does not stop the event. Any ideas would be helpful.


Solution

  • Cell widgets use event delegation: the event that triggers and gets passed to your Cell's onBrowserEvent is the same, caught at the same place, as the one that triggers sorting, so stopPropagation won't be of any help.

    Also, have a look at the code for CellTable (or AbstractCellTable in trunk): there's no way to prevent sorting. I'd suggest you file a request for enhancement on the issue tracker.