下面是带有默认文本的组合框的ExtJs3.2代码。当我单击组合框时,默认文本不会消失并且实际上被选中。您还可以通过输入名称的首字母来搜索组合中的名称。我应该怎么做才能选择默认文本,当我在组合内部单击时应该消失。
{
xtype: 'combo',
displayField: 'name',
emptyText:'Select Route'+"*",
id: 'road-edit-form-roadList',
allowBlank: false,
forceSelection :true,
typeAhead: true,
triggerAction: 'all',
mode: 'local',
valueField:'id',
store: new Ext.data.JsonStore({
//url: 'getRoadList',
url: 'ajax-route/ajax.jsp?action=getRoadList',
fields: ['id','name']
}),
listeners:{
'beforequery': function(qe){
qe.combo.getStore().load({
params:{
query:qe.query
}
});
}
}
}
答案 0 :(得分:0)
尝试添加
focus : function (thisCmp, eventObj, eventOptions) {
thisCmp.inputEl.dom.placeholder = ''; //force the removal of the placeholding text
}
更多参考:http://www.sencha.com/forum/showthread.php?230850-combo-with-watermark-problem