1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Vote Rating
    0
    Answers
    1
    Madiyana is on a distinguished road

      0  

    Default Answered: Combobox List - Virgin Line

    Answered: Combobox List - Virgin Line


    Hello ,
    Before starting I am sorry with my english.. I don't speak it well ..
    So I have a problem with the Combobox in ExtJS4 .. I tried to add a virgin line in my combobox list but It's not ok .. Now i have the list with a virgin line but when I trie to select it I can't.. so if someone can help me or have an example pliz
    Code:
    Ext.require([
        'Ext.form.*',
        'Ext.data.*',
        'Ext.tip.QuickTipManager'
    ]);
    
    
    Ext.onReady(function() {
        Ext.QuickTips.init();
    
    
          var form = Ext.create('Ext.form.Panel', {
            renderTo: 'docbody',
            title   : ' ',
            autoHeight: true,
            width   : 600,
            bodyPadding: 10,
            defaults: {
                anchor: '100%',
                labelWidth: 100
            },
            items   : [
                        {
                            xtype : 'fieldcontainer',
                            combineErrors: true,
                            msgTarget: 'side',
                            fieldLabel: ' Name',
                            items : [
                                {
                                    width:          50,
                                    xtype:          'combo',
                                    mode:           'local',
                                    triggerAction:  'all',
                                    forceSelection: true,
                                    editable:       false,
                                     selectOnFocus : true,
                                    name:           'title',
                                    displayField:   'name',
                                    valueField:     'value',
                                    tpl: '<tpl for="."><div class="x-combo-list-item">{name:defaultValue("--")}</div></tpl>',
                                    queryMode: 'local',
                                    store:          Ext.create('Ext.data.Store', {
                                        fields : ['name', 'value'],
                                        data   : [
                                            {name : 'Mvr',   value: 'mr'},
                                            {name : 'Mrs',  value: 'mrs'},
                                            {name : 'Miss', value: 'miss'}
                                        ],
                                        listeners :
                                            {
                                            'load' : function (store, records, options) {
                                                this.insert(0,'--');        
                                            }}
                                    })
                                }
                            ]
                        }
                    ]
        
        });
    });

  2. Remove the tpl and change the insert to:

    Code:
    this.insert(0, {name:'--', value:'--'});

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,616
    Vote Rating
    327
    Answers
    545
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Remove the tpl and change the insert to:

    Code:
    this.insert(0, {name:'--', value:'--'});

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    17
    Vote Rating
    0
    Answers
    1
    Madiyana is on a distinguished road

      0  

    Default


    Thank you .. It works ..

Thread Participants: 1

Tags for this Thread