我必须通过从查询字符串中读取页码来显示不同的页面。我尝试了很多选项都找不到任何解决方案。请找到我尝试过的内容,请帮忙。
URL:- http://'localhost'/TestApp/InnerPage.aspx?page=1
代码:-
/*tried to loop through the classes*/
var classList = $('.jtable-page-list');
$.each(classList, function (index, item) {
alert(this.innerHTML);
});
/*binding the jTable*/
$('#divJTableContainer').jtable('load', {
Name: $('#txtClient').val(),
RefNo: $('#txtrefNo').val(),
Email: $('#txtEmailid').val(),
Phone: $('#txtPhoneNumber').val(),
InsuredZip: $('#txtZipCode').val(),
AppDate: $('#txtStartDate').val(),
EffectiveDate: $('#txtToDate').val(),
Status: $('#ddlStatus').val()
});
类名甚至不在源代码中,因此不可能进行循环。我正在寻找一种 JTable 可以与页码绑定(bind)的方法。如果有人尝试过或遇到此类问题,请分享。
最佳答案
最后我通过编辑“jquery.jtable.js”找到了解决方案。
我们将页码分配给隐藏字段“hdnPageNumber”并从中获取页码。 此代码将影响所有引用 JTable 的页面。因此,请务必检查代码中所示的“.length”条件。
/* Overrides load method to set current page to 1.
*************************************************************************/
load: function () {
/*
Manual code added by Navajyoth.C.S on 19-09-2014
*/
if ($('#hdnPageNumber').length > 0) {
if ($('#hdnPageNumber').val() != "") {
this._currentPageNo = parseInt($('#hdnPageNumber').val());
}
else {
this._currentPageNo = 1;
}
}
else {
this._currentPageNo = 1;
}
/*
Commenting the old code
this._currentPageNo = 1;
*/
base.load.apply(this, arguments);
},
谢谢大家!!快乐编码
关于jquery - 根据查询字符串值进行 JTable 分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25918247/