jeudi 19 juin 2014

How to set a window loader param before the ajax call

Hi, i have a simple window, which is loading its contents automatically like this:

Code:



Ext.define('app.COMPONENTS.appVideoPlayer', {
extend: 'Ext.window.Window',
,title: 'Video Player'
,modal: true
,closable: true
,resizable: true
,width: 800, height: 600
,autoShow: true
,loader:
{
url: '/video/videocam_loader.html'
,scripts: true
,autoLoad: true
,loadMask: true
,params: { additionalParam: '' }


}

,initComponent: function()
{
var me = this;
me.callParent(arguments);
}
});

Now, i want upon the component creation (and before the loader's ajax call), to add an additional parameter to the loader's params like this:

Code:



Ext.create('app.COMPONENTS.appVideoPlayer', { paramToLoader: 'paramValue' });

So - before the ajax call, the params config to contain additionalParam: 'paramValue' Any suggestions?

In fact, i accomplished this via the beforeload listener within the loader config like this:

Code:



listeners: {
beforeload: function(loader, options)
{
options.params.additionalParam = loader.getTarget().paramToLoader;
}
}

But - i'm not sure if this is right approach


Aucun commentaire:

Enregistrer un commentaire