PDA

View Full Version : Auto fill json store fields for loading a grid



josh803316
21 Apr 2009, 8:50 AM
I would like to be able to populate my grid with different info from the json store without defining the fields first (Having the fields defined dynamically) so I can re-use the same grid extension for a lot of similar data from different tables in the db.

I looked at this thread and it looked very applicable but I don't know how to apply it to a grid store or if I am following it correctly.

http://extjs.com/forum/showthread.php?t=18361



jnms.data.manageStore = new Ext.data.JsonStore({
url: '/cgi/admin/load_grid.cgi',
root: 'info',
fields: [ ]
});

josh803316
21 Apr 2009, 9:16 AM
Oops, meant this for Ext 2.0 help.....but it probably is applicable to both.

keniled
16 Jun 2010, 4:28 AM
Hi josh,

I have exactly the same puzzle to solve :) Have you found the solution maybe?

josh803316
16 Jun 2010, 2:47 PM
Yes, you need to return your json with the metaData values defined by your server. This will allow you to map your fields dynamically without having to configure them in advance.

Take a look at the docs for Json Reader: http://www.sencha.com/deploy/dev/docs/

You will see an area where they talk about "Automatic Configuration"