【问题标题】:Jqgrid data not saved on edited row when select all clicked当全选单击时,Jqgrid 数据未保存在已编辑的行上
【发布时间】:2019-12-11 08:20:40
【问题描述】:

我像这样使用 Jqgrid:

 $("#grdMain" + TabID).jqGrid({

        datatype: 'local',

        colNames: ['ID', 'LookupCode','LookupTitle'],
        colModel: [

                    { name: 'ID', index: 'ID', hidden: true, editable: true, dataType: "number" },
                    { name: 'LookupCode', index: 'LookupCode', hidden: true },
                    { name: 'LookupTitle', index: 'LookupTitle', width: 100 }],
        localReader: {
            repeatitems: false,

            cell: "",
            id: "ID"
        },

        scrollOffset: 20,
        rowNum: 20,
        rowList: [10, 20],
        sortorder: 'asc',
        viewrecords: true,
        autowidth: false,
        gridview: true,
        forceFit: false,
        shrinkToFit: false,
        multiselect: true,
        width: 1255,
        height: 340,
        editurl: 'clientArray',
        rowNum: 1000000,
        direction: 'rtl',
        caption: '',
        gridstate: 'hidden',
        rownumbers: true,
        loadError: ServiceFailed,
        onSelectRow: function (rowid, isSelected) {

            $(this).editRow(rowid, true);

            $("#" + rowid + "_LookupTitle", "#grdMain" + TabID).lookup();

        },
        beforeSelectRow: function (rowid, e) {

            return DetailGridUtility.SaveDetail($(this), rowid, LastID);
        }, onSelectAll: function (ids, status) {

        }

    });

假设网格上有 10 行,我选择了 2 个第一行,第二行处于编辑模式,我更改了 lookupTitle(并且行仍处于编辑模式),现在我单击“全选复选框”,然后更改为第二行处于编辑模式的不被考虑

我该如何解决这个错误?

selectAll 之前有方法吗? (如果有,我可以为 SellectAll 保存更改)

【问题讨论】:

  • 使用哪个版本的 jqGrid - Guriddo jqGrid、free-jqGrid 或 jqGrid
  • 我用的是4.4.1版
  • 关于可编辑字段的第二个问题呢?当您选择一行时,函数查找是什么?如果您想获得帮助,请回答所有问题

标签: jquery jqgrid


【解决方案1】:

我解决了。我找到了 selectAll 复选框标记并为 mousedown 事件编写了函数并在此方法上保存了网格。此事件调用之前复选标记所有行。我无法使用 Click 事件或 change 事件,因为这些事件在选中所有行后调用

$("#cb_grdMain" + TabID).mousedown(function () {

   //Save Grid 
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 2015-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多