PDA

View Full Version : json data not getting loaded



talap01
1 Sep 2010, 1:01 AM
Can somebody help me what exactly the sissue is ?
Json data is not getting loaded in grid.


Ext.onReady(function(){

var proxy = new Ext.data.HttpProxy({
url: 'survey.json'
});

var reader = new Ext.data.JsonReader({
root: 'data',
fields: [{
name: 'appeId',
mapping: 'appeId'
}, {
name: 'survId'
}, {
name: 'location'
}, {
name: 'surveyDate'
}, {
name: 'surveyTime'
}, {
name: 'inputUserId'
}]
})



var store = new Ext.data.Store({
proxy:proxy,
// url: 'survey.json',
reader: reader
});


store.load();


// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [{
header: "appeId",
width: 60,
dataIndex: 'appeId',
sortable: true
}, {
header: "survId",
width: 60,
dataIndex: 'survId',
sortable: true
}, {
header: "location",
width: 60,
dataIndex: 'location',
sortable: true
}, {
header: "surveyDate",
width: 100,
dataIndex: 'surveyDate',
sortable: true
}, {
header: "surveyTime",
width: 100,
dataIndex: 'surveyTime',
sortable: true
}, {
header: "inputUserId",
width: 80,
dataIndex: 'inputUserId',
sortable: true
}],
renderTo: Ext.getBody(),
width: 540,
height: 200
});

});
Survey.json


{"data": [{"appeId":"1","survId":"1","location":"","surveyDate":"2008-03-14","surveyTime":"12:19:47","inputUserId":"1","inputTime":"2008-03-14 12:21:51","modifyTime":"0000-00-00 00:00:00"},
{"appeId":"2","survId":"32","location":"","surveyDate":"2008-03-14","surveyTime":"22:43:09","inputUserId":"32","inputTime":"2008-03-14 22:43:37","modifyTime":"0000-00-00 00:00:00"},
{"appeId":"3","survId":"32","location":"","surveyDate":"2008-03-15","surveyTime":"07:59:33","inputUserId":"32","inputTime":"2008-03-15 08:00:44","modifyTime":"0000-00-00 00:00:00"},
{"appeId":"4","survId":"1","location":"","surveyDate":"2008-03-15","surveyTime":"10:45:42","inputUserId":"1","inputTime":"2008-03-15 10:46:04","modifyTime":"0000-00-00 00:00:00"},
{"appeId":"5","survId":"32","location":"","surveyDate":"2008-03-16","surveyTime":"08:04:49","inputUserId":"32","inputTime":"2008-03-16 08:05:26","modifyTime":"0000-00-00 00:00:00"},
{"appeId":"6","survId":"32","location":"","surveyDate":"2008-03-20","surveyTime":"20:19:01","inputUserId":"32","inputTime":"2008-03-20 20:19:32","modifyTime":"0000-00-00 00:00:00"}] }

Animal
1 Sep 2010, 1:26 AM
How are you debugging?

steffenk
1 Sep 2010, 1:48 AM
where is the url? look to examples to get valid configuration. Also please use code tags.