1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    25
    Answers
    1
    Vote Rating
    0
    DmitryF is on a distinguished road

      0  

    Default Answered: Add blank entry to combobox

    Answered: Add blank entry to combobox


    Hello.
    I have a combobox with data.Store.
    How i can add an empty option to the combobox?

  2. A simple solution might be to use the combo's emptyText config option.

    If that doesn't work for you, you could always use the store's load event to insert a blank record..

  3. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    A simple solution might be to use the combo's emptyText config option.

    If that doesn't work for you, you could always use the store's load event to insert a blank record..
    Last edited by friend; 6 Jul 2012 at 8:47 AM. Reason: clarity

  4. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,910
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      1  

    Default


    Something like this should work:

    Code:
    // The data store containing the list of states
    var states = Ext.create('Ext.data.Store', {
        fields: ['abbr', 'name'],
        data : [
            {"abbr":"AL", "name":"Alabama"},
            {"abbr":"AK", "name":"Alaska"},
            {"abbr":"AZ", "name":"Arizona"}
        ],
        
        listeners: {
            load: function(store){
                var rec = { abbr: '', name: '-' };
                store.insert(0,rec);    
            }
        }
    
        
    });
    
    // Create the combo box, attached to the states data store
    Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Choose State',
        store: states,
        queryMode: 'local',
        displayField: 'name',
        valueField: 'abbr',
        renderTo: Ext.getBody()
    });
    Scott.

  5. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    25
    Answers
    1
    Vote Rating
    0
    DmitryF is on a distinguished road

      0  

    Default


    Thank you! It works great.

    Code:
    Ext.define('AM.store.Beers', {
        extend: 'Ext.data.Store',
        model: 'AM.model.Beer',
    
    
        listeners: {
            load: function(store) {
                var model = Ext.create('AM.model.Beer', {
                    id: '',
                    number: 'Not Set'
                });
                store.autoSync = false;
                store.insert(0,model);
            }
        }
    });

  6. #5
    Sencha User
    Join Date
    Nov 2012
    Location
    INDIA, Hyderabad
    Posts
    23
    Answers
    2
    Vote Rating
    0
    ravimaroju is on a distinguished road

      0  

    Default


    Great Work.. Its Working Absolutely fine
    Ravi Maroju

  7. #6
    Sencha User
    Join Date
    May 2013
    Location
    Hyderabad, India
    Posts
    16
    Answers
    1
    Vote Rating
    1
    hmnth1 is on a distinguished road

      0  

    Default


    How can i set a default value in selected state?

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