columnsorting

jQuery DataTables: how to sort by specific column? [closed]

故事扮演 提交于 2019-12-03 01:44:35
Here's the page: http://csuvscu.com/ I need to sort by the Date Column, right now it needs to read Nov 6, Nov 5 and lastly Oct 7. How do I do this? shaheenery Your Current Code: $('table').dataTable({ // display everything "iDisplayLength": -1 }); What you could do: oTable = $('table').dataTable({ // display everything "iDisplayLength": -1 }); oTable.fnSort( [ [0,'desc'] ] ); // Sort by first column descending But as pointed out in the comment below, this may be a cleaner method: $('table').dataTable({ // display everything "iDisplayLength": -1, "aaSorting": [[ 0, "desc" ]] // Sort by first

Create a generic sortableTable object to be used to alphabetically sort a table elements each time a column is clicked using only JavaScript

这一生的挚爱 提交于 2019-12-01 12:48:46
I'm working on project which don't use jQuery but only JavaScript and we have a need to sort alphabetically ascending a table values (without any external library). The objective is to sort rows elements each time a column ( th element) is clicked. Example If I have this table When I click on "Names", the table should be refreshed like that: When I click on "Tel", the table should be refreshed like that: I'm sharing my own solution here. If you have any remark or suggestions, please share. I'm updating my solution by adding an inverse order feature : When you first click on Names for example,

Create a generic sortableTable object to be used to alphabetically sort a table elements each time a column is clicked using only JavaScript

岁酱吖の 提交于 2019-12-01 11:57:29
问题 I'm working on project which don't use jQuery but only JavaScript and we have a need to sort alphabetically ascending a table values (without any external library). The objective is to sort rows elements each time a column ( th element) is clicked. Example If I have this table When I click on "Names", the table should be refreshed like that: When I click on "Tel", the table should be refreshed like that: 回答1: I'm sharing my own solution here. If you have any remark or suggestions, please