jQgrid在表单视图中显示隐藏列 [英] jQgrid show hidden column in form view

查看:16
本文介绍了jQgrid在表单视图中显示隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery("#CustomerDetailsGrid").jqGrid({
    //ignore other properties
    colModel: [
    { name: 'AccountNumber', index: 'AccountNumber', hidden: true, viewable: true }
],
    viewrecords: true        
});

我需要在网格视图中隐藏帐号"列,但在表单视图中显示它.(不编辑表单)

I need to hide the column "Account Number" in grid view but show it in the form view.(Not edit form)

推荐答案

如果要创建视图对话框,它将填充有关放置在行中的每一列的信息.行的 id(<tr> 元素的 id)将由前缀trv_"和相应列的名称构成.重要的是要了解,在表单中将填充有关 所有包含隐藏列 的信息,但 元素因为隐藏的列将被隐藏(有 style="display: none;").因此,要使信息可见,只需为相应的 <tr> 元素调用 jQuery.show() 函数即可.

If the View dialog will be created it will be filled with the information about every column placed in the rows. The id of the row (the id of <tr> element) will be constructed from the prefix "trv_" and the name of the corresponding column. It it important to understand, that in the form it will be filled the information about all columns inclusive hidden columns, but <tr> elements for the hidden columns will be hidden (has style="display: none;"). So to make the information visible it is enough to call jQuery.show() function for the corresponding <tr> element.

我准备了 小演示 来演示这一点.在演示中 id 列是隐藏的,但我使信息在视图选项的 beforeShowFormafterclickPgButtons 事件处理程序中可见:

I prepared the small demo which demonstrate this. In the demo id column are hidden, but I make the information visible inside of beforeShowForm and afterclickPgButtons event handler of the View options:

$("#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();
                      }
                  });

这篇关于jQgrid在表单视图中显示隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆