[英]jqgrid get all grids column names
有没有办法获得所有网格的列名?
You can get the column names with 您可以使用以下命令获取列名称
var columnNames = $("#list")[0].p.colNames;
or 要么
var columnNames = $("#list").jqGrid('getGridParam','colNames');
The only small problem is that the array columnNames
will contain up to three empty first elements in case of you use rownumbers:true
, multiselect:true
or subGrid:true
parameters. 唯一的小问题是,数组
columnNames
将包含在案件多达三个空的第一要素使用rownumbers:true
, multiselect:true
或subGrid:true
的参数。 This parameters to follow to inserting in the colModel
additional columns with the names 'rn'
, 'cb'
or 'subgrid'
. 此参数遵循在
colModel
插入名称为'rn'
, 'cb'
或'subgrid'
其他列。 So you can either just ignore the first empty elements of columnNames
or look additionally in the colModel
( $("#list")[0].p.colModel
or $("#list").jqGrid('getGridParam','colModel')
). 因此,您可以忽略
columnNames
的第一个空元素,或者另外查看colModel
( $("#list")[0].p.colModel
或$("#list").jqGrid('getGridParam','colModel')
)。 The colModel
and colNames
arrays has the same length and the colModel[i].name
can be used to examine whether colNames[i]
is the name of "real" column or an additional column added because of the usage one from the tree above mention parameters. colModel
和colNames
数组具有相同的长度, colModel[i].name
可用于检查colNames[i]
是否为“real”列的名称或添加的其他列,因为上面提到的树中的用法参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.