不可能将列动态添加到jqGrid
.您必须使用colModel
再创建一列来重新创建整个网格.如果使用单独的colNames
,则数组的大小也必须增加.例如,您可以使用GridDestroy
销毁现有网格.您实际上可以像往常一样绑定一个额外的列,但是可以在运行时使用jquery
显示/隐藏它们.因此,您可以只添加一列,然后根据需要使用.
It is not possible to add a column to the jqGrid
dynamically. You have to recreate the whole grid with colModel
having one column more. If you use separate colNames
, then the size of the array have to be increased too. You can use GridDestroy
for example to destroy the existing grid. you can actually bind an extra column as normal but you can show/hide them at runtime using jquery
. So you could just add a column and hide/show it as per your requirement using .
$("#grid").showCol("column_name");
$("#grid").hideCol("column_name");
这篇关于JQGrid列自定义..在运行时添加列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
上岸,阿里云!