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

查看:307
本文介绍了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_"和相应列的名称构成.重要的是要理解,该表单将填充有关所有包含隐藏列的信息,但是隐藏列的<tr>元素将被隐藏(具有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列中是隐藏的,但是我使该信息在View选项的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天全站免登陆