make multi column sorting user friendly
make multi column sorting user friendly
Lancy
Posts: 4Questions: 1Answers: 0
Hi Allan,
I have a requirement to sort multiple columns without holding shift key. I have looked into datatable code and I found that if I pass e.shiftKey to true then sorting works properly without holding shift key.
_fnSortListener( settings, colIdx, true, callback );
instead of
_fnSortListener( settings, colIdx, e.shiftKey, callback );
Can I do this change or is their a better way to handle my requirement?
Thanks,
Lancy
This discussion has been closed.
Answers
yes, push back.
If you make that change, isn't it always just going to keep adding more columns to the sorting?
Depending on what you want to achieve exactly, perhaps using
columns.orderData
might be useful.Allan
Hi Allan,
Thanks for the quick response. I appreciate.
I think my requirement was not clear. I will attach some images.
We have used some of the events of datatable and added sort icon & sort order to every column. in below images we have sorted the grid on first column by default ("Column1_sort.Png")
when user clicks on column 2 then user expects second column should get sorted but with column 1 as primary sort for doing this he needs to hold shift key.
(Column2.PNG)
similarly when user clicks on column3 (column3.png)
now my requirement is to get rid of shift key. i.e., they need the same sort feature but without holding shift key.
Thanks,
Lancy
What if they want to sort by column 3 as the primary sorting column? What would be the interaction for that?
Allan
Oh ok, Got it. In that case they need to remove sort from all the columns and then sort column 3.
Thanks allan, I will update you on this.
To use the shift key to multi select is standard user interface stuff. To make a browser operate in a non-standard way makes it more awkward for new users.
I tend to push back when non-standard behavior is requested. I don't always win but I try, hence the short response above.
@bindrid: I agree. Sometimes users need to be told "no".