Javascript 如何通过提供不同的url重新加载网格';s到网格
我想在检查不同的单选按钮时重新加载我的网格,但我想向网格提供新的URL,以在网格中提供不同的列 这是我的单选按钮,我想给我的网格提供不同的urlJavascript 如何通过提供不同的url重新加载网格';s到网格,javascript,jquery,extjs,Javascript,Jquery,Extjs,我想在检查不同的单选按钮时重新加载我的网格,但我想向网格提供新的URL,以在网格中提供不同的列 这是我的单选按钮,我想给我的网格提供不同的url { boxLabel: ' 1', name: 'rb-horiz-3', inputValue: 1, listeners: { check: function(){ //what i write here to // reload grid with different url ....
{
boxLabel: ' 1', name: 'rb-horiz-3', inputValue: 1,
listeners: {
check: function(){
//what i write here to
// reload grid with different url ....
}}
}
这是我的网格
{
xtype:'grid',
store:new Ext.data.JsonStore({
id:'store_id',
root:'result',
totalProperty:'total',
fields:[
{name:'rank'},
{name:'pg'},
],
baseParams:{start:0,limit:20},
url:'pgrouting!getGridData.action',//this i want to change on checking of radio button...
autoLoad:true,
method:'POST'}
正如@MMT在评论中所说的,将绑定的代理的url设置为新url,然后对存储执行加载
check: function(){
var url = http://example.com/data; // set the specific url
// what you need here is a reference to your grid or store
var store = grid.getStore(); // get the store from the grid
var proxy = store.getProxy(); // get the proxy from the store
proxy.setUrl(url); // change the url of the proxy
store.load(); // load the new data
}}
检查侦听器中需要的是对网格或网格存储的引用。尝试在侦听器中设置
store
的proxy.url
,例如grid.getStore().getProxy().url=“url”
是的url已更改,但是加载函数使加载无限..网格正在持续加载..在更改url后,您是否在网络选项卡中看到对新url的网络请求?