jQuery TableSorter working only on ID (numeric field), not on other fields like text , date etc-Collection of common programming errors
In my web application I have maintain table for the user records. Records are added and deleted on client send and than user clicks on save button to save all the manipulations done on the server.
I have applied table sorter for the sorting functionality on the table. But surprisingly sorted functionality is working fine for only ID field ie the first field of table, but for all other fields, it is giving error (error trace from chrome)
Uncaught TypeError: Cannot read property 'type' of undefined
multisortjquery.tablesorter.js:600
$.extend.tablesorter.construct.each.$headers.click.mousedown.onselectstart
Here is the table structure.
ID | Name | Birth Date | City | Action |
---|---|---|---|---|
In this I add data dynamically. In this situation sorting is working fine for only first field ie ID field
This is how I initialized the tableSorting.
function initializeTableSorting() {
$("#contentTable").tablesorter({
sortList : [[0, 0]],
headers : {
0 : {
sorter : "integer"
},
1 : {
sorter : "text"
},
2 : {
sorter : false
},
3 : {
sorter : "text"
},
4 : {
sorter : false
}
}
});
}
How can I make this work for all fields, even also for date field if I remove the false option from the initialization ?