Reputation: 2495
Just to be clear, I'm not asking about populating a grid's records using a json file. I want to create the grid's columns themselves using json. So as to recreate a grid. All the columns attributes, including width, locked, visible etc are to be saved in a json and that json has to be used to recreate the grid as it was.
How do I go about that?
Upvotes: 0
Views: 72
Reputation: 353
If your JSON is a string in var myJSON
and is in format:
{
myColumnDefinitions: [
{
text: "ColTitle1",
dataIndex: "colfield1",
width: 100
},
{...}
]
}
Your grid syntax should be as simple as
...
extend: 'Ext.grid.Panel',
columns: Ext.JSON.decode(myJSON).myColumnDefinitions
...
Upvotes: 1