Search code examples
javaeclipsenattable

How to Reset/Clear the multi column sorting in a NatTable?


In My example NatTable having 5 Columns. While creating nattable applying sorting for column 2 and 3 using SortColumnCommand(layer,position accumulate). It is applying sort in ASC order for column 2 and 3.

Now i want to Reset/Clear the column sorting for all columns, so that NatTable should not contain any sorting.

Is there any API or Mechanism to Reset/Clear the Sorting for all columns? Or Even it is fine to reset the columns one by one.


Solution

  • If you know the ISortModel this is one option. Another option would be to fire a SortColumnCommand with SortDirectionEnum#NONE.

    natTable.doCommand(new SortColumnCommand(sortHeaderLayer, 0, SortDirectionEnum.NONE));