Hidden Columns in jqGrid

前端 未结 7 1859
不思量自难忘°
不思量自难忘° 2020-12-12 18:20

Is there any way to hide a column in a jqGrid table, but have it show as read-only when the row is edited in the form editor modal dialog?

7条回答
  •  悲&欢浪女
    2020-12-12 18:43

    This feature is built into jqGrid.

    setup your grid function as follows.

    $('#myGrid').jqGrid({
       ...
       colNames: ['Manager', 'Name', 'HiddenSalary'],
       colModel: [               
                   { name: 'Manager', editable: true },
                   { name: 'Price', editable: true },
                   { name: 'HiddenSalary', hidden: true , editable: true, 
                      editrules: {edithidden:true} 
                   }
                 ],
       ...
    };
    

    There are other editrules that can be applied but this basic setup would hide the manager's salary in the grid view but would allow editing when the edit form was displayed.

提交回复
热议问题