PDA

View Full Version : Problem using Ext.ux.form.ItemSelector



wasima
10 Nov 2012, 7:36 AM
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 when item is double clicked it moves 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 override 'moveRec' method as shown in code and it works now what i want is when i double click on item of Selected Panel they need to be removed from Selected list and it does not goes back to Available list but I am not able to do this:


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,
selected = me.getSelections(me.fromField.boundList);


me.moveRec(true, selected);
me.toField.boundList.getSelectionModel().select(selected);
} ,
moveRec: function(add, recs) {
var me = this,
fromField = me.fromField,
toField = me.toField,
fromStore = add ? fromField.store : toField.store,
toStore = add ? toField.store : fromField.store;


fromStore.suspendEvents();
toStore.suspendEvents();
// fromStore.remove(recs);
toStore.add(recs);


fromStore.resumeEvents();
toStore.resumeEvents();


fromField.boundList.refresh();
toField.boundList.refresh();


me.syncValue();
}


});


Please help me.Thanks in advance

mitchellsimoens
14 Nov 2012, 10:15 AM
Are you saying that it stays in available or that what you want to happen?

wasima
14 Nov 2012, 8:58 PM
Thanks Mitchell Simoens

Let me expalin in steps:

Step 1: At start Ext.ux.form.ItemSelector has 2 panels 'Available' and 'Selected' , 'Available' has items 'a' and 'b'.and Selected panel list empty.
Step2: Double click 'a' , Available has 'a' and 'b' , Selected has 'a' .//works fine
Step3: Double click 'a' of Selected panel , now Available must have 'a' and 'b' only and not 'a' ,'b' and 'a' and Selected panel list must be empty. // not working

Hope i am clear this time