make multi column sorting user friendly

make multi column sorting user friendly

LancyLancy 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

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    yes, push back.

  • allanallan Posts: 61,732Questions: 1Answers: 10,110 Site admin
    edited June 2017

    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

  • LancyLancy Posts: 4Questions: 1Answers: 0

    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

  • allanallan Posts: 61,732Questions: 1Answers: 10,110 Site admin

    What if they want to sort by column 3 as the primary sorting column? What would be the interaction for that?

    Allan

  • LancyLancy Posts: 4Questions: 1Answers: 0

    Oh ok, Got it. In that case they need to remove sort from all the columns and then sort column 3.

  • LancyLancy Posts: 4Questions: 1Answers: 0

    Thanks allan, I will update you on this.

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    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.

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    @bindrid: I agree. Sometimes users need to be told "no".

This discussion has been closed.