Ext.data.Store动态修改url

时间:2021-12-04 15:12:32

store.proxy = new Ext.data.HttpProxy({url:path});

示例:

    var ad_store = new Ext.data.JsonStore({
fields: ["id", "title1", "title2", "content", "pid", "position", "publish_time", "end_time", "pic_url", "link_url","ad_tag", "total_read_num"],
url: 'php/action/ad_oper.php?op=query_all&start=0&limit=15&type=' + type,
totalProperty: 'total',
root: 'data'
});

修改url:

tbar: [{
text: '增加',
handler: addAd
}, {
text: '筛选游戏:',
border: false
}, {
id: 'select_game',
xtype: "combo",
hideLabel: true,
mode: "local", //由于数据已定义所以必须写成local
triggerAction: 'all', //想要加载所有项就要这么写,网上这么说的,我没试过不写
editable: true,
emptyText: "请选择",
store: game_info_store,
valueField: 'gid',
displayField: 'nameCN', //不写这项的话,你会发现下拉项是空的没内容哦
listeners: {
'select': function(src, val) {
gid = val.data.gid;
url = 'php/action/ad_oper.php?op=query_all&start=0&limit=15&gid='+gid+'&type=' + type;
ad_store.proxy = new Ext.data.HttpProxy({url:url});
ad_store.reload();
}
}
}],

程序猿必读