如何通过为网格提供不同的url来重新加载网格

How to reload grid by providing different url's to grid

本文关键字:网格 新加载 加载 url 何通过      更新时间:2023-09-26

我想重新加载我的网格检查不同的单选按钮,但与新的url,我想提供给网格给不同的不同列内网格..

这是我的单选按钮,我想给我的网格不同的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
}}

检查侦听器中需要的是对网格或网格存储的引用。