Dynamic Proxy URL for store.load() in MVC architecture with Ext JS

会有一股神秘感。 提交于 2019-12-06 04:10:06

When you call this.store.load() in initComponent the store is not initialized yet. The property this.store is string at the moment of calling. You have to call for loading after your widget's parent initComponent (where the store initialization is happening) was called:

initComponent: function() {
    ...
    this.callParent(arguments);
    this.store.load();    
    ....

I would add that another common way to load data at the last moment is with the afterrender listener on the grid itself like this:

       listeners: {
             afterrender: function(grid) {
                grid.store.getProxy().url = 'request/my.json'; //modify your URL
                grid.store.load();    
             }
        }

As you can see you can also influence your store and proxy settings. This help with reuse of the stores for similar grids.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!