仅禁用WWID列而不禁用两列enter code here
请帮助我禁用两列或更多列
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(); }
},
答案 0 :(得分: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(); }
},
...
);
答案 1 :(得分: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(); }
},
...
);