JQgrid只查看选中的记录

JQgrid view only selected records

我知道这可能看起来是重复的,无论如何,告诉我哪一个,因为我花了 2 天时间寻找类似的问题但无济于事。 我有一个 table,其中用户可以通过检查它们和选项“查看记录”来 select 行。 我的问题是“查看记录”窗格内的导航按钮完全不考虑 selected 行。 如果我有四行并选中第 1 行和第 3 行,因为我只想查看这两行的记录,我在看到记录 1 后单击下一步按钮,然后显示第 2 行,而不是第三行。这不是想要的行为。 任何人都知道如何使“查看记录”的导航按钮只允许在 selected 行之间导航? 非常感谢。

哦,这是我的代码:

    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", search: true, sortable: true,prefix:null,},
        {name: "customerId", label: "Customer-ID", search: true, sortable: true,prefix:null,}

    ];

    $(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 对编辑模式执行相同的操作。这个选项(editselected)也存在于旧版本中。

此功能将在计划于 2020 年 9 月 1 日发布的即将发布的版本中提供

这是一个有效的 Guriddo demo