Change a Value of the columnModel JQgrid after dra

2019-06-10 10:48发布

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

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

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

Thanks.

1条回答
贼婆χ
2楼-- · 2019-06-10 11:12

You can get reference to internal colModel using getGridParam:

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

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});
查看更多
登录 后发表回答