Rob*_*ben 9 jquery jqgrid jqgrid-asp.net
jQuery("#CustomerDetailsGrid").jqGrid({
//ignore other properties
colModel: [
{ name: 'AccountNumber', index: 'AccountNumber', hidden: true, viewable: true }
],
viewrecords: true
});
Run Code Online (Sandbox Code Playgroud)
我需要在网格视图中隐藏"帐号"列,但在表单视图中显示它.(不编辑表单)
小智 13
最好的方法是只添加editrules:{edithidden:true}选项.
colModel: [{ name: 'AccountNumber', index: 'AccountNumber', hidden: true, viewable: true,editrules:{edithidden:true} }]
Run Code Online (Sandbox Code Playgroud)
Ole*_*leg 11
如果将创建"视图"对话框,则将填充有关放置在行中的每个列的信息.行的id(<tr>
元素的id )将从前缀"trv_"和相应列的名称构造.重要的是要理解,在表单中将填充包含隐藏列的所有列的信息,但隐藏列的<tr>
元素将被隐藏(has style ="display:none;").因此,为了使信息可见,调用jQuery.show()
相应<tr>
元素的函数就足够了.
我准备了演示这个的小演示.在演示id
列中隐藏了,但是我在View选项的内部beforeShowForm
和afterclickPgButtons
事件处理程序中可以看到信息:
$("#list").jqGrid('navGrid','#pager',
{add:false,edit:false,del:false,view:true,search:false},
{}, // edit options
{}, // add options
{}, // del options
{}, // search options
{ // vew options
beforeShowForm: function(form) {
$("tr#trv_id",form[0]).show();
},
afterclickPgButtons: function(whichbutton, form, rowid) {
$("tr#trv_id",form[0]).show();
}
});
Run Code Online (Sandbox Code Playgroud)