View Full Version : How do I generate dynamic grid's column based on the data from database?

7 Nov 2010, 7:39 PM
Hi, all !

Here is I have a couple data retrieved from the database in JSON format such as:

"success": true,
"total_rows": 10,
"root": [
{"day": 1, "productA": 1000, "productB": 100, "productC": 200, ..., "productX": 300}

Take a look at the "product" part of JSON data. This part is dynamic, means sometimes generates only 3 products but sometimes more than 10 products..
Then, how do I build a grid which generate a column(s) as much as and titled as the data I retrieved?

Thank you before.


7 Nov 2010, 11:39 PM
You could use something like this (http://www.sencha.com/forum/showthread.php?76406-jsonStore-gt-panel.items&p=371353#post371353).