0

Only WWID column is disabled not both columns are disabledenter code here please help me to disable two or more columns

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(); }
},
4

2 回答 2

0
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(); }
    },
    ...
);
于 2014-04-21T06:18:52.353 回答
0

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

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(); }
    },
    ...
);
于 2013-08-14T11:38:15.163 回答