extjs 获取store为空问题

var states = Ext.create('Ext.data.Store', { //[{name:'lineId'},{name: 'id'}]
 autoLoad: true,
fields: [{name:name},{name: 'id'}],
proxy: {
type: 'ajax',
url : getLineOrSubJson,
reader: {
type: 'json'
}
}
});
  

  然后获取store时总是为空,应该是异步加载时机问题,懒得追问,想在下面的代码中读取store中数据,可以修改下

var states = Ext.create('Ext.data.Store', { //[{name:'lineId'},{name: 'id'}]
// autoLoad: true,
fields: [{name:name},{name: 'id'}],
proxy: {
type: 'ajax',
url : getLineOrSubJson,
reader: {
type: 'json'
},
sync : true 
}
});



states.on("load",function(){ 
   //you can get store here..
}
}); 
states.load();

  

 

 

  

posted @ 2013-03-21 17:45  CrossZhu  阅读(403)  评论(0编辑  收藏  举报