首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使两列在“添加”对话框中可编辑,但在jqgrid中的编辑过程中不可编辑

如何使两列在“添加”对话框中可编辑,但在jqgrid中的编辑过程中不可编辑
EN

Stack Overflow用户
提问于 2013-08-14 11:17:09
回答 2查看 189关注 0票数 0

只有WWID列是禁用的,而不是两列都禁用,请帮助我禁用两个或多个列。

代码语言:javascript
运行
复制
colNames: ['UserName','WWID', 'Generic', 'Mac'],
                            colModel: [
                                { name: 'UserName', index: 'UserName', key: true, width: '200', editable: true, sortable: true, align: 'center' },
                                { name: 'WWID', index: 'WWID', width: '250' , editable: true, sortable: true,sorttype:'int', align: 'center' },
                                { name: 'Generic', index: 'generic', width:'200', editable: true, sortable: true,sorttype:'text', align: 'center' },
                                { name: 'Mac', index: 'mac', width:'200',  editable: true, sortable: true,sorttype:'int', align: 'center' },
                            ],
...............
});
jQuery("#gridId").jqGrid('navGrid', '#gridpager',
            { edit: true, add: true, del: true, search: true, excel: true, exceltext: 'Excel', cloneToTop: true },
            { // edit option
              url: "Uploading.ashx", closeAfterEdit: true,afterSubmitCell: function () { $('#gridId').trigger('reloadGrid');},
              beforeShowForm: function (form) { $('#tr_UserName', form).hide(); },
              beforeShowForm: function(form) { $('#tr_WWID', form).hide(); } 
},
{ // add option
              url: "Uploading.ashx", closeAfterAdd: true,
              beforeShowForm: function(form) { $('#tr_UserName', form).show(); },
              beforeShowForm: function (form) { $('#tr_WWID', form).show(); }
},
EN

Stack Overflow用户

发布于 2013-08-14 11:38:15

您应该只提供一个beforeShowForm回调,它将显示/隐藏两行。在您的情况下,只使用最后一个提供的。您的代码应该如下所示:

代码语言:javascript
运行
复制
jQuery("#gridId").jqGrid('navGrid', '#gridpager',
    { edit: true, add: true, del: true, search: true, excel: true, exceltext: 'Excel', cloneToTop: true },
    //Edit options
    {
        url: "Uploading.ashx",
        closeAfterEdit: true,
        afterSubmitCell: function () { $('#gridId').trigger('reloadGrid'); },
        beforeShowForm: function (form) { $('#tr_UserName', form).hide(); $('#tr_WWID', form).hide(); }
    },
    //Add options
    {
        url: "Uploading.ashx",
        closeAfterAdd: true,
        beforeShowForm: function(form) { $('#tr_UserName', form).show(); $('#tr_WWID', form).show(); }
    },
    ...
);
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18230273

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档