PDA

View Full Version : Mapping simple Javscript object to a table of names and values



bimargulies
25 Jul 2012, 1:06 PM
Consider:



var o = {
"Color": "blue",
"Continent": "Africa"
};


I want to render this as a table of two columns: names and values. The object keys go into the first column, the values into the second.

I started down the path of the Ext grid panel for this, and I get the feeling that the technology is gigantically overkill. Am I missing something simple?

scottmartin
25 Jul 2012, 2:13 PM
You may be interested in Property Grid:
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid/property.html

Scott.

bimargulies
25 Jul 2012, 2:50 PM
Is there a way to dynamically load this with data?

scottmartin
25 Jul 2012, 2:51 PM
You can use store.loadData(object)

Scott.