问题描述
我知道这似乎是重复的,并且一定要告诉我哪一个,因为我花了2天的时间来寻找类似的问题,但无济于事。 我有一个表,用户可以在其中通过检查行和选项“查看记录”来选择行。 我的问题是,“查看记录”窗格内的导航按钮完全使选定的行完全无效。 如果我有四行,并且因为只想查看这两行的记录而检查了第1行和第3行,则在看到记录1和第2行而不是第3行之后,我单击了下一个按钮。这不是通缉的行为。 任何人都有一个想法如何使“查看记录”的导航按钮仅允许在所选行之间导航? 预先非常感谢。
哦,这是我的代码:
var resultItems = [
{
customerId: 20000001,customerName:"Customer 1",},{
customerId: 20000002,customerName:"Customer 2",{
customerId: 20000003,customerName:"Customer 3",{
customerId: 20000004,customerName:"Customer 4",}
];
var fields = [
{name: "Id",label: "Id",search: true,key: true},//,hidden:true
{name: "customerName",label: "Kunde",sortable: true,prefix:null,{name: "customerId",label: "Customer-ID",}
];
$(function () {
"use strict";
$.jgrid.guiStyles.jQueryUI.dialog.window = "dijitPopup ui-jqgrid-jquery-ui ui-widget ui- widget-content ui-corner-all ui-front";
$("#enhancedReportingGrid").jqGrid({
datatype:"local",colModel: fields,data: resultItems,iconSet: "fontAwesome",loadonce: true,viewrecords: true,width: 780,height: 200,multiselect:true,pager: "#enhancedReportingGridPager",});
$('#enhancedReportingGrid').jqGrid('navGrid','#enhancedReportingGridPager',{add: false,edit: false,del: false,search: false,view: true},{width: 500});
});
解决方法
我建议您切换到支持的商业Guriddo jqGrid版本。
我刚刚在Guriddo jqGrid中添加了viewGridRow方法中的一个 viewselected 选项,该选项允许您以多选模式仅查看选定的行。选项 editselected 对编辑模式执行相同的操作。此选项(已编辑选择)也存在于较旧版本中。
此功能将在计划于2020年9月1日发布的即将发布的版本中提供
这是工作中的Guriddo demo