Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1325
How to change sort direction?
posted

Hi Team,

On my last posts it takes many days to get a reply. Please give a solution in this as soon as possible.

I had asked it previously, but till now there was no reply on it.

 

The thing is that by default the sorting is occuring as defined:

- On first click of the column header the sort will happen in ascending order.

and in second click in descending order and so and so.

 

But my scenario is that I want

- on first click have to sort in ascending, on second click revert back to previous condition (None as unsorted form of data - in columns as on first load) and on third click descending sort. Then on fourth unsorted and on next ascending and so and so.

So please do reply on this as soon as possible.

Thanks in advance.

Regards,

Assyst

Parents
  • 33839
    Suggested Answer
    posted

    Hi Assyst,

    This is not a built in behavior of the grid.  You will have to do this yourself.  What you would need to do is to handle the column sorting client event and cancel it.  In that event, off of the event args, you can get the column that was going to be sorted.  You can see if it is sorted and if it is, then unsort it.  But you would need to store yourself which direction to sort an unsorted column.  You would also need to decide if you want to clear other columns' sorting if a different column is about sort.  Hopefully this gets you started.

    regards,

    David Young 

Reply Children