Extjs4 - Ajax请求:Url生成 [英] Extjs4 - Ajax Request : Url generation
问题描述
Ext.define('Cc.store.Absences' ,{
extends:'Ext.data.Store',
model:'Cc.model.Absence',
autoLoad:false,
proxy:{
type :'ajax',
url:'person / user_id /缺席',//我需要一个参数来定义用户ID
reader:{
type:'json'
}
}
});
我想我必须使用Ext.data.Operation,但是我不知道该怎么做
如果您正在寻找动态生成URL并将其分配给商店,可以按如下方式进行: / p>
store.getProxy()。url ='/ person /'+ user_id +'/缺席'
store.load(); //需要重新加载你的商店。
要作为正常参数(POST或GET方法)传递,可以使用Warung Nasi
如果您计划自动生成参数以进行排序,筛选,分组等,则可以使用 Ext.data.Operation
到你店的代理。您可以在 Ext.data.proxy.Ajax文档。参考Url Generation子标题。
I need to set an ajax request with a generated url.
Ext.define('Cc.store.Absences', {
extend: 'Ext.data.Store',
model: 'Cc.model.Absence',
autoLoad: false,
proxy: {
type: 'ajax',
url: 'person/user_id/absences', //I need a param to define user id
reader: {
type: 'json'
}
}
});
I think I have to use Ext.data.Operation but I don't know how to do that.
If you are looking to dynamically generate an URL and assign it to the store, you can do it as follows:
store.getProxy().url = '/person/' + user_id +'/absences';
store.load(); // need to reload your store.
To pass as normal parameters (POST or GET methods), you can use the technique explained by Warung Nasi.
You can use Ext.data.Operation
if you plan generate parameters automatically for sorting, filtering , grouping etc to your store's proxy. You can read about the possible parameters in Ext.data.proxy.Ajax documentation. Refer the Url Generation sub heading.
这篇关于Extjs4 - Ajax请求:Url生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!