1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Korea
    Posts
    8
    Vote Rating
    0
    Answers
    1
    penot is on a distinguished road

      0  

    Default Answered: combobox displayField duplicate Value Problem

    Answered: combobox displayField duplicate Value Problem


    Hi,

    I'm using extjs 4.1

    This problem is Comboboxs Store Data displayField Value Duplicate select
    and out of focus by Combobox worked change event then
    auto select change first duplicate value ..


    Code:
    {
        xtype: 'combobox',
        width: 160,
        id : "sms_itemCode",
        name : "itemCode",
        fieldLabel: '',
        labelAlign: 'right',
        "store": itemSimple_List,
        "valueField": 'valueData',
        "displayField": 'viewData',
        "typeAhead" : true,
        "transform" : 'stateSelect',
        "forceSelection" : true,
        "queryMode": 'local',
            allowBlank : false,
        disabled: true,
        x: 775,
        y: 20,
        "doQuery" : function(queryString, forceAll) {
            this.expand();
            this.store.clearFilter(!forceAll);
    
    
            if (!forceAll) {
                this.store.filter(this.displayField,queryString);
            }
        },
        listeners : {
            change : function(combo, newval, oldval, eOpts){
                console.log(newval);
                console.log(oldval);
                console.log(eOpts);
                this.getStore().clearFilter(true);
            }
        }
    }

    EX > store Data ValueField, DisplayField
    [ {1, "comp"},
    {2, "comp"} ]
    I select 2, comp then auto change 1, comp

    console logs

    1040100113 <-- select combobox Item
    comp <-- display value (autocomplite oldval)
    Object <-- eOpts

    1040100112 <-- out of focus auto change

    Thanks in advanced.

  2. The displayField values need to be unique as well

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,641
    Vote Rating
    898
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The displayField values need to be unique as well
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread