Search code examples
reactjssortingmaterial-table

material-table third state to sort column


Using the material-table react component, I saw a strange behaviour on sorting a column.

Clicking a column 3 times removes the sort. You can try to sort the column name on this example.

Is there a way to remove 3 states (ascending, descending and back to the original state) behaviour and have only 2 (ascending, descending) ?


Solution

  • It seems like a bug, but it's the intended behaviour. It has added in material-table component and the story is described here

    In order to disable this behaviour and have only 2 states, you have to disable thirdSortClick

     <Table
       options={{
         thirdSortClick: false
       }}
       title=...
       data=...
    />