not working json with grid
http://stackoverflow.com/questions/8954253/how-to-use-json-with-extjs
by molecule
HTML
<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.7-gpl/resources/css/ext-all.css">
JavaScript
var data = {"locations":{
"cc0001":{
"category":[""],
"name":"",
"address":"",
"lat":"",
"long":"",
"tel":"",
"opening":"",
"closing":""
}
}
var store=Ext.create('Ext.data.Store', {
data: data,
autoLoad : true,
fields: [{ name:'id'},
{name: 'name'},
{name: 'category'},
{name: 'address'},
{name: 'lat'},
{name: 'long'},
{name: 'tel'},
{name: 'opening'},
{name: 'closing'}],
root: "locations",
proxy:{
type: 'ajax',
url : '../descrittore/json.php?',
method : 'GET',
reader: 'json'
})
});
store.load();
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "appeId", width: 60, dataIndex: 'id', sortable: true},
{header: "survId", width: 60, dataIndex: 'category', sortable: true},
{header: "location", width: 60, dataIndex: 'lat', sortable: true},
{header: "surveyDate", width: 100, dataIndex: 'long', sortable: true},
{header: "surveyTime", width: 100, dataIndex: 'opening', sortable: true},
],
renderTo:'example-grid',
width:540,
height:200
});