Possible to disable sorting of multiple columns?

Possible to disable sorting of multiple columns?

techpeacetechpeace Posts: 5Questions: 0Answers: 0
edited July 2011 in General
Hi Allan,

Apologies if this is already listed in your extensive and thorough documentation, but is it possible to only allow sorting on a single column at a time? I have a table with AJAX processing enabled, and I'd like to simplify the server-side logic by disallowing the multiple-column sorting. Thanks!

- Matt Buck

Replies

  • techpeacetechpeace Posts: 5Questions: 0Answers: 0
    I'm also willing to tackle adding this option myself - just wanted to check to make sure it didn't already exist. Thanks!
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    There isn't a build in way to stop multi-column sorting. However there are a couple of avenues I can suggestion:

    1. In the DataTables code look for the comment "/* If the shift key is pressed then we are multipe column sorting */" and remove that block.

    2. You could unbind the default event listener and attach your own which will always override e.shift to be false.

    Allan
  • techpeacetechpeace Posts: 5Questions: 0Answers: 0
    Great, thanks for pointing me in the right direction! Went ahead and added this as a feature option in my fork: https://github.com/DataTables/DataTables/pull/13
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    That's awesome - thanks! I'll have a closer look at the pull request in the next few days.

    Regards,
    Allan
This discussion has been closed.