Is there a way to get all of the grid's column names?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
You can get the column names with
or
The only small problem is that the array
columnNames
will contain up to three empty first elements in case of you userownumbers:true
,multiselect:true
orsubGrid:true
parameters. This parameters to follow to inserting in thecolModel
additional columns with the names'rn'
,'cb'
or'subgrid'
. So you can either just ignore the first empty elements ofcolumnNames
or look additionally in thecolModel
($("#list")[0].p.colModel
or$("#list").jqGrid('getGridParam','colModel')
). ThecolModel
andcolNames
arrays has the same length and thecolModel[i].name
can be used to examine whethercolNames[i]
is the name of "real" column or an additional column added because of the usage one from the tree above mention parameters.