绘制后更改columnModel JQgrid的值 [英] Change a Value of the columnModel JQgrid after draw
问题描述
当我绘制网格时,我会有一些这样的列.
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屋!