PDA

View Full Version : Only allow combo box to be chosen once in a group of combo boxes.



jakejamessteele
31 Jul 2013, 1:11 PM
Hey Sencha,

Was hoping for some help, I have a trigger system developed, however in my Match All conditions it makes sense that each dropdown box value could only be selected once.

Aka:
Match All
Time is 8:00
Time is 9:00
Would always fail as it would never meet both those conditions... I want time to disappear from the other combo boxes while its selected and disappear when its changed.

Was thinking of removing it from the store and then refreshing the combo boxes, only problem is I force selection and it clears it from the combo box.

Ok so Here was my solution... I solved it :D


####.####.Parameter = new Ext.extend(Ext.form.ComboBox, {
type: 'all',
oldrec: null,
store: null,
constructor: function (config) {
var me = this;
if (config.type === 'all') {
me.store = AllConditionStore;
} else {
me.store = ####.####('RuleParameterType');
}
config = Ext.apply({
store: me.store,
valueField: 'id',
hideActive: true,
triggerAction: 'all',
lazyRender: true,
allowBlank: false,
mode: 'local',
displayField: 'text',
listeners: {
select: function (me, recs, index) {
if (me.oldrec !== null)
me.store.add(me.oldrec);
me.oldrec = recs;
me.store.remove(recs);
}
}
}, config);
####.#####.Parameter.superclass.constructor.call(this, config);
}
});


Ext.reg('####.####.parameterCombo', ####.####.Parameter);

mitchellsimoens
2 Aug 2013, 12:14 PM
new Ext.extend

That doesn't look good.

jakejamessteele
2 Aug 2013, 12:14 PM
Working great, what do you recommend?