Extjs4 - Ajax Request : 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: { t
Solution 1:
use extraParams
more info
Ext.define('Cc.store.Absences', {
extend: 'Ext.data.Store',
model: 'Cc.model.Absence',
autoLoad: false,
proxy: {
type: 'ajax',
extraParams : {
id : "123"
},
url: 'person/user_id/absences', //I need a param to define user id
reader: {
type: 'json'
}
}
});
Solution 2:
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.
Post a Comment for "Extjs4 - Ajax Request : Url Generation"