Reseting Table column ASC/DESC sort states

Hi!

If setSortEnabled(true) for the Table, one can sort any column in ascending/descending way by clicking its header.
Then, the appropriate up/down arrow appears right to the column name, representing its sort state. The sorting depends on the container implementation, which is clear.

Is there a way to break out of the magical circle of clickings ASC-DESC-ASC-DESC… of those sorted column states (with arrows), and to get back to column initial unsorted state (without any arrow) by means of user interface (by clicking some column area, or key combination) or by doing it programatically?

Thanks!

In brief, does Vaadin Table column have “clear sort” option, besides “ascending” and “descending” ones?

You may get an idea of it from this showcase (http://www.smartclient.com/smartgwt/showcase/#grid_sort_sort).
(I should announce here, that I’m not a supporter of SmartGWT: on the contrary, I think Vaadin is implicitly superior in all the ways.)

Hi,

as far as I know, there’s no way to reset/remove the sorting from the UI directly. However you can add a reset button and call com.vaadin.ui.Table.sort(Object, boolean
) with empty arrays. This should clear the sorting.

Thanks for advice, it clears the sorting back to initial!

Yet, the sorting arrow keeps staying at column’s header, which confuses, of course. Is there any way to clear it away too?

Tried it with Vaadin 7.1.10, didn’t have a chance to try it with elder releases.

Cheers.

Some containers support returning to an unsorted state after sorting while others don’t. I believe this is one of the original reasons why the Table does not support completely removing the sort indicators once the table has been sorted by the user.

There is an enhancement request about this (
#12711
) and also
#8978
is somewhat related to this.

The code that prevents resetting sorting indicator on the client is in VScrollTable.updateSortingProperties(UIDL) (handling messages from the server) and VScrollTable.HeaderCell.handleCaptionEvent(Event) (handling mouse clicks to sort data) in case you want to hack something together for this in your application.