1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    93
    Vote Rating
    0
    vijayakumar84 is on a distinguished road

      0  

    Default Unanswered: How to load array value in combo in extjs4.1 using xtype:combo

    Unanswered: How to load array value in combo in extjs4.1 using xtype:combo


    Hi
    can anybody tell how to load array value in using xtype:combo and give example in extjs4.1




    Thanks

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi vijay,

    See this sample code -
    Code:
    var states = Ext.create('Ext.data.ArrayStore', {
           fields: ['abbr', 'state'],
        data :[['1', 'hello'],['2', 'hi'],['3', 'bye']]
    });
    
    
    // Create the combo box, attached to the states data store
    Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Choose State',
        store: states,
        queryMode: 'local',
        displayField: 'state',
        valueField: 'abbr',
        renderTo: Ext.getBody()
    });
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    93
    Vote Rating
    0
    vijayakumar84 is on a distinguished road

      0  

    Default


    Hi My values are coming in for loop.I want to load for loop values can you tell how to do.How to push my value to store

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Posts
    93
    Vote Rating
    0
    vijayakumar84 is on a distinguished road

      0  

    Default


    Hi,
    My values are coming form for loop can anybody tell how to push these value in combo

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Answers
    4
    Vote Rating
    3
    girish.arjunagi is on a distinguished road

      0  

    Default


    var localArrayStore = Ext.create('Ext.data.ArrayStore', {
    fields : [
    'key',
    'value'
    ],
    });
    populate the arrayStore variable with the data you are parsing in the for loop and assign it to combo object store.
    combo.getStore().add(localArrayStore)

  6. #6
    Sencha User
    Join Date
    Jan 2013
    Posts
    34
    Answers
    4
    Vote Rating
    0
    mkrakowski is on a distinguished road

      0  

    Default


    If you can get the back end to populate the value param, then it's easy.

    Code:
    data :[['1', 'hello'],['2', 'hi'],['3', 'bye']]
    value : '0' // select "hello" in combo box on render
    Alternatively you can do something like this:

    PHP Code:
    value : '<?php echo $myValue ?>',
    listeners: {  
      afterrender: function(combo) {    
        if (combo.getValue() === '') { combo.setValue(combo.store.getAt('0').raw.label); } 
        // Set item 0 as default value if one is not being set  }
      }
    }
    Hope that helps.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi