Results 1 to 3 of 3

Thread: Only allow combo box to be chosen once in a group of combo boxes.

  1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    47
    Vote Rating
    0
      0  

    Default Only allow combo box to be chosen once in a group of combo boxes.

    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
    Code:
    ####.####.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);

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Code:
    new Ext.extend
    That doesn't look good.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    May 2013
    Posts
    47
    Vote Rating
    0
      0  

    Default

    Working great, what do you recommend?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •