PDA

View Full Version : Problem overriding functions of Ext.ux.form.ItemSelector in derived class



akraman
3 Nov 2012, 11:55 PM
Hi ,
i am working on Ext.ux.form.ItemSelector, using which a window appears and we have two panels, 'Available' and 'Selected' , any item in Available panel double clicked moves to Selected panel, but i want the item double clicked to move to Selected Panel as well as retained in original list of Available items for example if 'Available' Panel had two items 'a' and 'b' , if i double clicked 'a' , 'a' will be available in 'Selected' Panel but also retained in 'Available' panel, so i tried extending base class and override these methods as shown i code:


Ext.define('abcd.cm.monitoring.view.Common.MonitorSelector', { extend: 'Ext.ux.form.ItemSelector', alias: 'widget.monitorselector', requires: [ 'Ext.ux.form.ItemSelector' ], initComponent: function() { var me = this; me.callParent(); } , onAddBtnClick : function() { var me = this, fromList = me.fromField.boundList, selected = this.getSelections(fromList); fromList.getStore().remove(selected); this.toField.boundList.getStore().add(selected); }, onRemoveBtnClick : function() { var me = this, toList = me.toField.boundList, selected = this.getSelections(toList); toList.getStore().remove(selected); // this.fromField.boundList.getStore().add(selected); }, onItemDblClick : function(view) { var me = this; if (view == me.toField.boundList){ me.onRemoveBtnClick(); } else if (view == me.fromField.boundList) { me.onAddBtnClick(); } }});I am not able to get desired result.can anybody help me .
thanks in advance

akraman
3 Nov 2012, 11:57 PM
sorry , i didnt add code with code tags properly ,


here it is :


Ext.define('abcd.cm.monitoring.view.Common.MonitorSelector', {
extend: 'Ext.ux.form.ItemSelector',
alias: 'widget.monitorselector',
requires: [
'Ext.ux.form.ItemSelector'
],








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




onAddBtnClick : function() {
var me = this,
fromList = me.fromField.boundList,
selected = this.getSelections(fromList);




fromList.getStore().remove(selected);
this.toField.boundList.getStore().add(selected);
},
onRemoveBtnClick : function() {
var me = this,
toList = me.toField.boundList,
selected = this.getSelections(toList);




toList.getStore().remove(selected);
// this.fromField.boundList.getStore().add(selected);
},
onItemDblClick : function(view) {
var me = this;
if (view == me.toField.boundList){
me.onRemoveBtnClick();
}
else if (view == me.fromField.boundList) {
me.onAddBtnClick();
}
}
});