lundi 9 juin 2014

load window component without ajax call

Hi, gieven code works fine , but i want to store the ajax response data into a variable and to use at the loader url section. can it be possible or any other way to fulfill this purpose.

Ext.define('MyDesktop.GridWindow', {

extend: 'Ext.ux.desktop.Module',

requires: [

'Ext.data.ArrayStore',

'Ext.util.Format',

'Ext.grid.Panel',

'Ext.grid.RowNumberer'

],

id:'grid-win',

init : function(){

this.launcher = {

text: 'Grid Window',

iconCls:'icon-grid',

handler : this.createWindow,

scope: this

}

},

createWindow : function(src){

//var desktop = MyDesktop.getDesktop();

var desktop = this.app.getDesktop();

var win = desktop.getWindow(src.id);

if(!win){

var cfg = {

// 'focusOnToFront: false' prevents the windows from

// grabbing the focus and making the page jump around

// as the windows load in IE.

focusOnToFront: false,

shadow: false,

renderTo: desktop.body,

id: src.id + '_win',

configId : src.id,

title: src.text,

width: (src.width ? src.width : MyDesktop.defaultWidth),

tools: src.tools,

height: (src.height ? src.height : MyDesktop.defaultHeight),

iconCls: 'icon-grid',

autoDestroy:false,

closable:false,

constrain:true,

animCollapse:false,

constrainHeader:false,

layout: 'fit',

minimizable: false,

items: [{

region:'center',

layout: 'fit',

border: false,

id: src.id + '_viewport',

autoScroll: false,

loader: {

url: '{{$this->Html->url('/dashboard/loadWindow/')}}'+src.id+'?grid=1',

text: 'Loading...',

autoLoad: true,

loadMask: true,

renderer: 'html',

timeout: 30,

scripts: true

}

}]


};


cfg = MyDesktop.calculatePosition(src, cfg);

win = desktop.createWindow(cfg);

}


// Note: calling win.show() before adding the event handlers

// keeps the handlers below from being called on the initial

// load. That way, when each window is created, there aren't

// five different save operations running together. (Yes five,

// when the "Windows" menu is created, the checkbox click

// handler for the window is called too.)

win.show();


// Nudge windows on a 'Reset Layout' load. Note: For some

// reason setPosition() only works after a show() call. :/

if (isReset) { win.setPosition(cfg.x, cfg.y + 4); }


win.on({

'render' : { fn: winOpen, scope: this },

'close' : { fn: winClose, scope: this },

'move' : { fn: winMove, scope: this },

'resize' : { fn: winResize, scope: this }

});

},

closeWindow : function(src){

var id = (typeof(src) == "object") ? src.id : src;

var win = this.getWindow(id);

if(win){

var _id = win.configId;

win.close();

dashmenu.items.get(_id).setChecked(false);

}

},

maximizeWindow : function(src){

var id = (typeof(src) == "object") ? src.id : src;

var win = this.getWindow(id);

if(win){

win.maximize();

}


},

restoreWindow : function(src){

var id = (typeof(src) == "object") ? src.id : src;

var win = this.getWindow(id);

if(win){

win.restore();

}


},

getWindow: function(id){

var winId = id + '_win';

var win = MyDesktop.getDesktop().getWindow(winId);

if (!win) {

winId = id + '-v41_win';

win = MyDesktop.getDesktop().getWindow(winId);

}

return win;

}

});





Aucun commentaire:

Enregistrer un commentaire