Reputation: 81
I have a table that i am trying to have sorted. For example, cell A1 will hold the value TBA, cell A2, will hold the value 15, cell A3 will be 10, etc... The value of the cells are from a form that gets filled out. The problem that I am having is when I sort the column, it is not sorting correctly. The table will either sort one of 2 ways. The first way is: 15,10,TBD. The second way is: TBD, 10,15. I am trying to get the table to sort this way. 10,15,TBD. I cannot seem to figure out why this is not working. I am using the jquery tablesorter plugin. This is the script that I have for sorting the table.
<script type = "text/javascript" src = "/Rodeo Display Board/jquerytablesorter/jquery.tablesorter.js"> </script>
<script>
$(document).ready(function(){
$("table").tablesorter({
stringTo: "max",
headers:{
2: { sorter: "digit", string:"max"}
}
});
});
</script>
I have looked at examples from the tablesorter webpage, and the example i was looking at, did not work out, as in sorting the same way as now. Also, I find that when I put my table id in, the sort stops to work. This does not work. $("table3").tablesort({ insert code})
I also found on the plugin website what I am looking to do, but when i implement that code, it does not work. This is the website that I am referring to, and I have already downloaded and referenced the plugin. https://mottie.github.io/tablesorter/docs/example-options-headers-digits-strings.html. The column that contains what I am looking for is column 5. Column 5 has a cell that contains text, another cell containing a number and so on. According to the code, column 5 sorting is being referenced by a class name. When I implement that class name, there is no sorting that is occurring.
Upvotes: 0
Views: 232
Reputation: 185
I'm not sure how to make it sort correctly, but to get this to work with an ID, you'll need to use the pound sign (#).
Upvotes: 1