绘制后更改columnModel JQgrid的值 [英] Change a Value of the columnModel JQgrid after draw

查看:304
本文介绍了绘制后更改columnModel JQgrid的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我绘制网格时,我会有一些这样的列.

when i draw the grid i have some column like this..

name: 'codigo', index: 'codigo', width: 50, align: 'center', editable: true }

但是在我要查询然后设置可编辑选项(例如,设置为false)之后,这可能吗?

But after i want to do a query and then set the editable option, for example to false, is this possible?

谢谢.

推荐答案

您可以使用getGridParam获取对内部引用:

You can get reference to internal colModel using getGridParam:

var colModel = $("#grid").jqGrid("getGridParam", "colModel");

现在,您可以枚举colModel数组中的元素,并找到具有值为"codigo"的属性name的元素.之后,您可以修改colModel数组元素的editable属性.在答案中查看getColumnIndexByName函数,以获取代码示例.

Now you can enumerate elements in colModel array and find the element which has property name with the value "codigo". After that you can modify editable property of the element of colModel array. Look at getColumnIndexByName function from the answer for a code example.

最简单的方法是使用

The most simple way to do what you want is the usage of setColProp method

$("#grid").jqGrid("setColProp", "codigo", {editable: false});

这篇关于绘制后更改columnModel JQgrid的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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