Table sort customization


I am very new to vaadin and I am stuck with a problem. I’m not sure whether it is doable or not. Please someone help me. Here is what I want to do:

I have a table. When I click on the column header, I want the sort sign (asc/desc) to be changed but no sorting should be done. Rather an event will be thrown letting me know on which column I need the sort action and in what order. Then I will take care of the sorting and display new sorted result.

Please someone tell me how can I achieve this, or if it is doable at all.

Thanks in advance.

Well the way you propose it is not (easily) doable. But you can achieve something similar by writing your own Container-Implementation and let it implement

Disable sorting using this method:

setSortDisabled(boolean sortDisabled) 

Then implement and add your own Table.HeaderClickListener:

addListener(Table.HeaderClickListener listener) 

That solution won’t switch the sort-sign.

That’s right, but when Table.HeaderClickListener is implemented you have a full control over header click actions, so there is no problem to set an icon using this method:

setColumnIcon(Object propertyId, Resource icon) 

I actually started implementing like you said. Was confused about the icon part. Thanks a lot for that.