PDA

View Full Version : How to load json object into store dynamically and update grid?



abondili
2 Jul 2013, 3:29 AM
I have a grid which is supposed to be updated by the remote JSON object data into the grid's store and display it. I have the written like this below but it is not working well...


var myStore = Ext.data.StoreManager.get("driveScheduleStore");
var tempStore = Ext.data.StoreManager.get("tempDSStore");
var grid = Ext.getCmp('driveScheduleGridPanel');

var strSearch = Ext.getCmp('TeamNumSearch').getValue();
Ext.Ajax.request({
url: '.../TEST/GetDriveScheduleDataFilter.php',
method: 'POST',
params:{teamnum:newValue},
success: function(result, request) {
var json = result.responseText;
var temp = JSON.parse(json);

//myStore.loadData(temp.SCHEDULE);
grid.getStore().loadData(temp.SCHEDULE);
Ext.Msg.alert('Message',temp.SCHEDULE.length);

//Ext.Msg.alert('Message',temp.SCHEDULE);
//myStore.load();

},failure: function(result, request) {
Ext.Msg.alert('Error', 'An Error occured...');
}
});

carol.ext
2 Jul 2013, 10:00 AM
What do you mean by not working well? What result do you get? Is there a good reason why you are not having the store load its own data?


I have a grid which is supposed to be updated by the remote JSON object data into the grid's store and display it. I have the written like this below but it is not working well...