PDA

View Full Version : Web Desktop issues when navigate in windows



pratik016
21 Jan 2013, 4:45 AM
Hello Friends,

I have created webdesktop architecture in MVC structure. But I have problem when open more than one window and open previous opened window, I can not navigate the page after then. But newly open window is works fine.

Here is the sample code for created MVC:
app.js


Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext.ux.desktop': 'lib/js'
}
});


Ext.application({
name: 'Mydesktop',
controllers: ['Mydesktop']
});


And from Mydesktop view I have set the webdesktop architecture. and all window opens from it.

After window open I have created new MVC for my real application


createWindow: function () {

var desktop = this.app.getDesktop();
var win = desktop.getWindow('one-win');


if (!win) {
Ext.application({
name: 'Mydesktop',
appFolder: 'app',
controllers: [
"layout.SampleOne"
],
launch: function () {
if (Ext.getCmp('one-win'))
Ext.getCmp('one-win').destroy();
win = desktop.createWindow({
id: 'one-win',
title: 'SampleOne',
maximized: true,
//modal: true,
width: 740,
height: 480,
border: false,
y: 0,
autoHeight: true,
resizable: true,
iconCls: 'icon-grid',
//animCollapse: false,
//constrainHeader: true,
layout: 'anchor',
items: [{
layout: 'anchor',
xtype: 'sampleone'
}],


listeners: {
resize: function (t, w, h, ow, oh) {

}
}
});
win.show();
}
});
}
return win;
}


I also attached my sample code here. Please let me know if anyone knows how to handle MVC in webdesktop archtecture.

Thanks in advance :)

pratik016
10 Mar 2013, 11:59 PM
Resolved!
For others which may have same issue:
Just load view file using required. And in controller, when load this view load respective controller using getController.



win = desktop.createWindow({
id : 'admin-win',
title : 'Administration'.l('SC30000'),
maximized : true,
width : 740,
height : 480,
border : false,
y : 0,
autoHeight : true,
resizable : true,
iconCls : 'icon-administration',
layout : 'fit',
items : [{
layout : 'fit',
xtype: 'administration'
}
]});


When administration view load, then do afterrender event on parent controller and load controller of administration.


this.control({
administration : {
afterrender : function (e, n, r, i) {
var s = t.getController("layout.Administration");
s.init();
}
}
})


Its work for me, hope for others as well. Let me know if any difficulty on it.