问题
I'm using jqGrid in which the Next/Last pager is enabled even when there is no records in the jqgrid during a filter condition is applied.
I have a demo of @Oleg, in which first select "5" in the number of rows displayed in the pager. Then filter the grid in which it shows no records. Now you can see the Next/Last pager button still enabled while the Previous/first is disabled.
I need to disable the First/Previous, Next/Last and the rowList(5,10,20,50).
I'm using the datatype:local but i dont use loadonce:true.
Here is the Demo
回答1:
I suppose that you use datatype: "local" or datatype: "json" or datatype: "xml" together with loadonce: true. In the case I would recommend you to add the following localReader:
localReader: {
page: function (obj) {
if (obj.rows == null || obj.rows.length === 0) {
return "0";
}
}
}
It should fix the problem with enabled Next and Last buttons in the pager.
回答2:
Debugging the code i found this, Modifying the code of @Oleg.
This works fine for me:
localReader: {
page: function (obj) {
if (obj.rows == null || obj.rows.length === 0) {
return "0";
}
}
}
The else part gets the row count of the page and bind it to the pager. So the grid gets collapsed.
Thanks @Oleg for your answer.
来源:https://stackoverflow.com/questions/27268215/disable-next-last-pager-in-jqgrid