-
Notifications
You must be signed in to change notification settings - Fork 196
additionalProperties option makes unneeded hidden columns in local scenario
Starting with version 3.7 jqGrid support local holding of data in internal data
and _index
parameters. Only if one use remote datatype
("json"
or xml
) without loadonce: true
jqGrid don't hold any local data and all data need be saved in DOM, for example by usage hidden columns in colModel
.
Saving information on HTML page in DOM makes the grid slowly and takes additional resources (for example memory) of the web browser.
I described in the old aswer the advantages of the usage datatype: "local"
and saving additional information associated to the rows of the grid inside of data
object. It makes very easy to implement many advanced scenarios (see the answer for example which demonstrates the usage of subgrids with hierarchical local data).
The implementation of TreeGrid in jqGrid 4.7 and in free jqGrid 4.8 is so that the information about the structure of Tree () will be saved in both places: locally in properties of data
and in 6/7 hidden columns of jqGrid: level
, parent
, isLeaf
, expanded
, loaded
, icon
(one use lft
and rgt
instead of parent
in case of usage treeGridModel: "nested"
). New version of free jqGrid eliminates unneeded hidden columns and uses only local data
.
During reading input data jqGrid read all data for colModel
skipping three reserved columns "rn"
(created in case of usage rownumbers: true
option), "cb"
(created in case of usage multiselect: true
option) and "subgrid"
(created in case of usage subGrid: true
option). Old version of jqGrid (or free jqGrid) have no direct possibility to read and to save locally additional properties of every item of input data.
New additionalProperties
option allows to specify array of properties which needed be read from every item of input data. In case of usage TreeGrid jqGrid insert the properties of treeReader
(level
, parent
, isLeaf
, expanded
, loaded
and icon
in case of usage treeGridModel: "adjacency"
) at the end of additionalProperties
array. It makes unneeded to extend colModel
with the data.
To read any custom properties of input items and to save the values in data
together with other data one need just specify the names of the properties in the additionalProperties
array.