mardi 23 septembre 2014

Using ExtraParams with Url Parameter

Hello *,

I want to extract Url Parameters store it in a Singleton and use the Parameter as ExtraParams in a Proxy.


Here I fetch The Parameters and store it in my Runtime Singleton.



Code:



Ext.define('Dms.Application', {
extend: 'Ext.app.Application',

name: 'Dms',


stores: [
// TODO: add global / shared stores here
],

launch: function () {
// TODO - Launch the application
Ext.setGlyphFontFamily('FontAwesome');
var qs = Dms.config.Runtime.queryString();
Dms.config.Runtime.setEntityType(qs.entityType);
Dms.config.Runtime.setEntity(qs.entity);
}
});

And here I want to use them.


Code:



Ext.define('DocItemTree', {
extend: 'Ext.data.Model',


fields: [
{ name: 'id', type: 'string' },
{ name: 'name', type: 'string' }
],


proxy: {
type: 'rest',
url: '/api-ci/DocItemTree',
// TODO: Use extra paramter to get only items which are corresponig to actual entity
extraParams: {
entity: Dms.config.Runtime.getEntity(),
entityType: Dms.config.Runtime.getEntityType()
}
}
});

But it seems to be to late to set the params in the launch method, also the init method is to late.

regards,

Marko






Using ExtraParams with Url Parameter

Aucun commentaire:

Enregistrer un commentaire