I am using jquery table sorting plugin.
The table columns are generated based on the sql query.
How can I sort (asc and desc) based on attribute value.
Note: i dont want like the following code, because the table column is generate mulitiple(some times 50 columns), so i need to sort all column based on same attribute name.
$.tablesorter.addParser({
// set a unique id
id: 'myParser',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-something');
},
// set type, either numeric or text
type: 'text'
});