I'm working with a table and I need that the header of a particular column be disable but this column need to be sorted by JQUERY, do somebody knows how do I have to do it?
Here is the jQuery code:
function TaskSortingAndFiltering() {
var taskTable = $("#TaskTable");
if (taskTable != null && taskTable.attr('rows') != undefined) {
// If exists at least one Task, set the paging and sorting to the table
if (taskTable.attr('rows').length > 1) {
$("#TaskTable")
.tablesorter({
sortList: [[2, 0], [1, 0]],
headers: {
0: { sorter: false },
2: { sorter: 'custom-date' }
}
})
.tablesorterPager({
container: $("#pager"),
size: 10
});
}
}
}
$(document).ready(function () {
// add parser through the tablesorter addParser method
$.tablesorter.addParser({
// set a unique id
id: 'custom-date',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s) {
s = '' + s; //Make sure it's a string
if (s.length == 0 || s == " ") {
return "ZZZ";
}
var hit = s.match(/(\d{2})-([A-Za-z]{3})-(\d{2})/);
if (hit && hit.length == 4) {
ret开发者_开发知识库urn hit[3] + months[hit[2].toUpperCase()] + hit[1];
}
else {
return s;
}
},
type: 'text'
});
LoadTaskJS();
});
精彩评论