PDA

View Full Version : How to select a window widget in MVC this.control



31 Mar 2013, 6:31 PM
I use tabPanel open two Controller,share a window,Event triggered two times?

but can not use 'AView #gp_materiallist'


AController:


init: function () {
this.control({
'button[action=btn_openwindow]': {
click: function(){Ext.widget('MaterialInfoWindow').show();}
},
'#gp_materiallist': {
itemdblclick: this.selectMaterialInfo
}
});
},
selectMaterialInfo: function (gridpanel, record) {
....
}

BController:


init: function () {
this.control({
'button[action=btn_openwindow]': {
click: function(){Ext.widget('MaterialInfoWindow').show();}
},
'#gp_materiallist': {
itemdblclick: this.selectMaterialInfo
}
});
},
selectMaterialInfo: function (gridpanel, record) {
....
}

ShareWindow:


Ext.define('myMVC.view.windows.MaterialInfoWindow', {
extend: 'Ext.window.Window',
alias: 'widget.MaterialInfoWindow',


initComponent: function () {
var me = this;


Ext.applyIf(me, {
items: [
{
xtype: 'gridpanel',
itemId: 'gp_materiallist',
store: 'MaterialStore',
header: false,
forceFit: true,
columns: [
{
xtype: 'rownumberer'
}
],
viewConfig: {


},
selModel: Ext.create('Ext.selection.RowModel', {


})


}]
});

mitchellsimoens
2 Apr 2013, 6:31 AM
Event is triggered twice because in both controllers you are using '#gp_materiallist'. I'm not sure what you want.

5 Apr 2013, 4:55 PM
thanks mitchellsimoens !
I solved.




init: function () {
this.control({
'button[action=btn_openwindow]': {
click: function(){
var win = Ext.widget('MaterialInfoWindow');
win.show();
win.down("#gp_materiallist").action = "gp_materiallist_unique";
}
},
'gridpanel[action=gp_materiallist_unique]': {
itemdblclick: this.selectMaterialInfo
}
});
},
selectMaterialInfo: function (gridpanel, record) {
....
}