如何在 MVC 中处理 jqGrid 寻呼机
How to Handle jqGrid pager in MVC
我想自己处理 jqGrid Pager 而不是 jqGrid API
JqGrid 将所有数据存储到缓存中,但我不想将所有数据存储到缓存中,我想存储数据用户要求的行号。
当我在寻呼机上单击下一个或上一个按钮时调用 Action 方法并发送数据相关页码和行并显示。
并在寻呼机中更新页码。
我的Html代码:
<div id="jqTable">
<table id="jqGridTable"></table>
<div id="jqGridTablePager"></div>
</div>
我的JS代码:
$("#jqGridTable").jqGrid({
cache: false,
url: '@Url.Action("GetUserList", "Account")',
datatype: "json",
colNames: ['LoginID', 'Login Name', 'Group', 'Email ID'],
colModel: [
{ name: 'LoginID', hidden: true, index: 'LoginID', width: 300 },
{ name: 'LoginName', index: 'LoginName', width: 300 },
{ name: 'GroupID', index: 'GroupID', width: 200, sortable: false },
{ name: 'EmailID', index: 'EmailID', width: 300, sortable: false }
],
viewrecords: true,
rowNum: 5,
rowList: [5, 10, 20, 30],
pager: '#jqGridTablePager',
loadonce: true
});
请帮我解决这个问题
来自 jqgrid 选项 documentation:
loadonce - If this flag is set to true, the grid loads the data from
the server only once (using the appropriate datatype). After the first
request, the datatype parameter is automatically changed to local and
all further manipulations are done on the client side. The functions
of the pager (if present) are disabled.
如果您不打算一次从服务器加载所有数据,则将此标志设置为 false(或者不要将其全部设置为 false,默认为 false)
我想自己处理 jqGrid Pager 而不是 jqGrid API
JqGrid 将所有数据存储到缓存中,但我不想将所有数据存储到缓存中,我想存储数据用户要求的行号。
当我在寻呼机上单击下一个或上一个按钮时调用 Action 方法并发送数据相关页码和行并显示。
并在寻呼机中更新页码。
我的Html代码:
<div id="jqTable">
<table id="jqGridTable"></table>
<div id="jqGridTablePager"></div>
</div>
我的JS代码:
$("#jqGridTable").jqGrid({
cache: false,
url: '@Url.Action("GetUserList", "Account")',
datatype: "json",
colNames: ['LoginID', 'Login Name', 'Group', 'Email ID'],
colModel: [
{ name: 'LoginID', hidden: true, index: 'LoginID', width: 300 },
{ name: 'LoginName', index: 'LoginName', width: 300 },
{ name: 'GroupID', index: 'GroupID', width: 200, sortable: false },
{ name: 'EmailID', index: 'EmailID', width: 300, sortable: false }
],
viewrecords: true,
rowNum: 5,
rowList: [5, 10, 20, 30],
pager: '#jqGridTablePager',
loadonce: true
});
请帮我解决这个问题
来自 jqgrid 选项 documentation:
loadonce - If this flag is set to true, the grid loads the data from the server only once (using the appropriate datatype). After the first request, the datatype parameter is automatically changed to local and all further manipulations are done on the client side. The functions of the pager (if present) are disabled.
如果您不打算一次从服务器加载所有数据,则将此标志设置为 false(或者不要将其全部设置为 false,默认为 false)