Aswin Ramakrishnan
Aswin Ramakrishnan

Reputation: 3213

Ext JS Combo box with a text box

I'm new to Ext JS and I wanted to know if there is a way I could do something like this? (I understand, I can have the Combo box as editable instead of this. But wanted to know if I can do this.)

Combo-box with Text-box

Upvotes: 0

Views: 1617

Answers (3)

Aswin Ramakrishnan
Aswin Ramakrishnan

Reputation: 3213

Changed the tpl in Ext Designer and it worked. Though the answer is what @Francesco said, I'm just adding the XTemplate I used for reference.

<tpl for="."><li>{Name}</li></tpl><input type="text" value="Enter item"></input>

Upvotes: 0

jack.cap.rooney
jack.cap.rooney

Reputation: 1306

var strCmbDip = Ext.create('Ext.data.Store', {
 storeId: 'strCmbDip',
 fields: ['id','name'],
 proxy: {
    type: 'ajax',
    url: 'rtvstore.php',
    reader: {
        root: 'rootCmbDip'
    }     
 }
});    

var cmbDip = Ext.create('Ext.form.ComboBox',
    x: 150,
    width: 230,
    id: 'cmbDip',
    fieldLabel: 'Dip',
    labelAlign: 'top',
    selectOnFocus: true,
    allowBlank: false,
    emptyText: 'Select....',
    queryMode: 'remote',
    displayField: 'name',
    valueField: 'id',
    editable: true,
    triggerAction: 'all',
    minChars: 1,
    hideTrigger: true,
    loadingText: '',
    store: strCmbDip
});

Upvotes: 0

Francesco
Francesco

Reputation: 454

It can be done, but you have to extend ComboBox. One of the things you need to change is tpl.

If you have never done something like that, you can look at Saki's LovCombo.

Upvotes: 1

Related Questions