我在页面中有两个gridview。两个gridview包含单独的更新面板,两个gridview都有虚头。我想要排序gridview.So我使用Jquery.One gridview排序正确完成。我用于另一个gridview的相同的jquery,但不工作。我的代码
function SortTran(cell, sortOrder) {
var sorting = [[cell.cellIndex, sortOrder]];
$("#<%=gvCustomer.ClientID%>").trigger("sorton", [sorting]);
if (sortOrder == 0) {
sortOrder = 1;
cell.className = "sortDesc";
}
else {
sortOrder = 0;
cell.className = "sortAsc";
}
cell.setAttribute("onclick", "SortTran(this, " + sortOrder + ")");
cell.onclick = function () { SortTran(this, sortOrder); };
document.getElementById("<%=pnlCustomer.ClientID %>").scrollTop = 0;
}
function SetTranDefaultSortOrder() {
var gvHeader = document.getElementById("dummyTranHeader");
var headers = gvHeader.getElementsByTagName("TH");
for (var i = 0; i < headers.length; i++) {
headers[i].setAttribute("onclick", "SortTran(this, 1)");
headers[i].onclick = function () { SortTran(this, 1); };
headers[i].className = "sortDesc";
}
}
$.tablesorter.addParser({
id: 'balance',
is: function (s) {
return false;
},
format: function (s) {
return s;
},
type: 'number'
});
$(document).ready(function () {
$("#<%=gvCustomer.ClientID%>").tablesorter({
headers: {
2: {
sorter: 'balance'
}
}
});
SetDefaultSortOrder();
});
我用于另一个gridview的相同编码,但不能正常工作。为什么?无法在页面中对两个gridview进行排序?