简体   繁体   English

在ExtJS4中使用新的URL重新加载网格存储

[英]Reloading grid store with new url in ExtJS4

I used Simple Tasks example of Ext js 4.0 as my guide. 我以Ext js 4.0的Simple Tasks示例作为指导。 http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/simple-tasks/index.html I am now stucked with how to reload store for the grid. http://docs.sencha.com/extjs/4.2.0/extjs-build/examples/simple-tasks/index.html现在,我陷入了如何重新加载网格存储的问题。 I set a global variable which I used in my store. 我设置了我在商店中使用的全局变量。

    proxy: {
    type: 'ajax',
    url: '/api/cookbookrecipe/1/1/8/8/'+ global.currentcookbook,
    extraParams: { take: 1 },
    totalProperty: 'TotalRecordCount'
}

I set the global.currentcookbook to 0. Whenever a click was caught in the tree, global.currentcookbook is changing depending on the key of the selected node in the tree. 我将global.currentcookbook设置为0。每当在树中单击时,global.currentcookbook都会根据树中所选节点的键进行更改。

    global.currentcookbook = 1;
    this.getTasksStore().load();

So, I used the code above to reload the grid. 因此,我使用上面的代码重新加载了网格。 I can see using firebug that it is still calling the previous value of global.currentcookbook even though it was changed already. 我可以看到使用Firebug,即使它已经更改,它仍在调用global.currentcookbook的先前值。

Is it possible to change the url that the store is calling? 是否可以更改商店正在调用的URL?

You can mod the proxy's url before load . 您可以在load之前修改proxy's url。

var s = this.getTasksStore();
s.proxy.url = '/api/cookbookrecipe/1/1/8/8/' + 1;
s.load();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM