Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

If we want the columns in the grid to be in different order as thay are by default, we need to provide that order
in the config variable and all grid columns must be defined in the config variable.
For changing the column configuration like width,hidden etc., the appropriate properties are provided in the configuration for this column

For this purpose there is a Zf_configuration variable which we can use to provide this type of configuration.
- runtimeOptions.frontend.defaultState

The easyest way to get the columns configuration is to use grid 'getState()' method.
ex:
Ext.ComponentQuery.query('#adminUserGrid')[0].getState();
This will return the column state configuration for the adminUserGrid.
For get the configuration as string we can use the JSON.stringify()

 

Here is an example of config variable:

 

{
"#adminUserGrid": -> the selector for the grid where this configuration will be applied. In this example the order of the colums is important for us, that is why all of the columns are defined in the desired order
{
"columns":[
{
"id":"targetLanguage", -> column stateId
"width":100
},{
"id":"sourceLanguage",
"width":100
},{
"id":"roles"
},{
"id":"gender"
},{
"id":"surName"
},{
"id":"email"
},{
"id":"login"
},{
"id":"firstName"
},{
"id":"userGridActionColumn"
}
]
},
"#adminTaskGrid": -> secound selector for another grid
{
"columns":[
{
"id":"taskName","hidden":true
},{
"id":"taskGuid","hidden":true
}
]
}
}
  • No labels