PDA

View Full Version : Combobox List - Virgin Line



Madiyana
10 Nov 2012, 6:59 AM
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

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,'--');
}}
})
}
]
}
]

});
});

skirtle
10 Nov 2012, 12:05 PM
Remove the tpl and change the insert to:


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

Madiyana
10 Nov 2012, 12:20 PM
Thank you .. It works ..