Remove any sorting order (TreeTable)


I have a UI-Problem with my TreeTable and I hope someone can give me any advice. When the TreeTable is built, it has a special order (the order that was used when the datasource (HierarchicalContainer) was built). I want to give the user the opportunity to sort the Table by any column (so I don’t want to disable sorting). But on the other hand I want the user to be able to remove any sorting order set, so that the TreeTable changes back to the order it had, when the page was loaded. Is there any way to bring the TreeTable back to its initial sorting state and remove any sorting order the user chose? I found no method for that (discard() for example has no effect on the TreeTableUI as it seems to me) but I think there must be away to get this done without refreshing the page. Thanks for any help!


I have the same problem. :frowning:

For most of the supplied containers (including IndexedContainer and probably also HierarchicalContainer which inherits it), sorting is a “destructive” operation in the sense that the original order is lost. The sorting API does not support resetting the sorting order.

If you use a container which does keep information about the original sorting (perhaps a custom container), you can add a method there to reset sorting and then maybe a method in your TreeTable to call it.