Search code examples
javascriptjquerysortingjquery-pluginstablesorter

Tiny Table, how to initially sort based on two columns


i am using tiny table V3 for sorting the table and to include a search box on top of the table.

currently the sorting is happening based on column name i,e column 1 here is the working fiddle, http://jsfiddle.net/2vdh2ac8/3/ below is the result what i get after sorting based on name.

no. name    due date    comment
97  bob     01/16   this is a comment
912 daisy   01/14   this is a comment
15  hahaza  09/16   this is a comment
234 hoppy   01/16   this is a comment
56  ishmael 02/18   this is a comment
24  john    04/16   this is a comment
43  john    01/16   this is a comment
365 kindle  05/15   this is a comment
123 pickpic 06/16   this is a comment

what i want to achieve is, after sorting based on names, if the names repeat, then i have to sort those names based on due date. so for example john is appearing two times in the table hence i need the output as below

no. name    due date    comment
97  bob     01/16   this is a comment
912 daisy   01/14   this is a comment
15  hahaza  09/16   this is a comment
234 hoppy   01/16   this is a comment
56  ishmael 02/18   this is a comment
43  john    01/16   this is a comment
24  john    04/16   this is a comment
365 kindle  05/15   this is a comment
123 pickpic 06/16   this is a comment 

need help to figure how to do it.


Solution

  • After downloading the source code of the plugin and running it through jsbeautifier to un-minify it so I can read it, it seems what you're trying to achieve is not possible with this plugin.

    The option for the sort-column expects an integer and is only able to process that.

    I guess your best chance is to either not support sorting on multiple columns or look for another plugin that does include this feature.