Change a Value of the columnModel JQgrid after draw

好久不见. 提交于 2019-12-10 11:54:00

问题


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:


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});


来源:https://stackoverflow.com/questions/15109249/change-a-value-of-the-columnmodel-jqgrid-after-draw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!