Description
目的是不要每次都加载 json文件,从而加快运行速度。
Code
You could configure your stores with a memory proxy:
store: { model: 'Forum.model.Post', proxy:{ type: 'memory' reader: { type: 'json' root: 'posts' } } }
Then fetch the data once with an Ext.Ajax.request and load it into each store using the proxy:
Ext.Ajax.request({ url: '../api/json.php', success: function(response) { var result = Ext.JSON.decode(response.responseText); store.getProxy().data = result; store.load(); // same procedure for the other stores... } });