"On Toggle" event to sort a list in data grid from ascending to descending order

Mark shared this question 5 years ago
Answered

I tried using the "on toggle" event feature with a single button so when pressed first sorts a data grid in descending order, and when pressed the 2nd time should reverts back to ascending, but only the first event works. Whats wrong , or what am I missing??


The data grid sorts fine using "set value' and sort etc, but when reverting back using the "toggle" the data grid disappears except for the headers. When pressed again, it shows up correctly as the first event and so on and so forth.


Help!

Comments (3)

photo
1

I'm afraid the on toggle event is not able to restore the data grid values. Is not that powerful (yet). Instead of an 'on toggle' you can create 'on click' events and control each state using a variable.

photo
1

Can we do this at a column level? I need to be able to sort specific columns.


For example, I have a datagrid with 4 columns id, name, notes, references


I want to make id and name columns sortable for the user.


I tried to put a button next to the label in the datagrid but it seems i can have only one control there.. cannot have a button along with a label