extjs里用combobox,我想要既可以编辑又可以下拉,于是设editable为true,mode设为remote,但是这样一来,每次我用编辑的方法(不是下拉)输入值的时候,这个combobox会自动下拉并选择第一个选项,把我输入的值覆盖掉了,而mode设为local的时候却没有这个问题,请问如何解决?
代码:<div id="checkForm" align="center" style="margin:150px auto;"></div><script type="text/javascript">var checkResultStore=new Ext.data.JsonStore({
url:'http://localhost:8080/GSE/data/checkResult.json',
method:'POST',
autoLoad:true,
fields:['value','text']
});var clwxgzd_zjzForm=new Ext.form.FormPanel
(
{
id:'clwxgzd_zjz_form',
width:300,
title:"质检组",
renderTo:'checkForm',
autoHeight:true,
bodyStyle:'padding:5px',
layout:"form",
frame:true,
labelWidth:70,
labelAlign:'right',
defaults:
{
border:false
},
items:
[
{
xtype:'combo',
id:'check_result_enter',
fieldLabel:'质检结果',
blankText:"输入或选择",
emptyText:"请选择",
store:checkResultStore,
mode:'remote',
displayField:"text",
valueField:"value",
editable:true,
typeAhead:true,
enableKeyEvents:true,
forceSelection:false,
selectOnFocus:true,
triggerAction:'all'
} ]
}
);</script>extjsajax comboeditable覆盖
代码:<div id="checkForm" align="center" style="margin:150px auto;"></div><script type="text/javascript">var checkResultStore=new Ext.data.JsonStore({
url:'http://localhost:8080/GSE/data/checkResult.json',
method:'POST',
autoLoad:true,
fields:['value','text']
});var clwxgzd_zjzForm=new Ext.form.FormPanel
(
{
id:'clwxgzd_zjz_form',
width:300,
title:"质检组",
renderTo:'checkForm',
autoHeight:true,
bodyStyle:'padding:5px',
layout:"form",
frame:true,
labelWidth:70,
labelAlign:'right',
defaults:
{
border:false
},
items:
[
{
xtype:'combo',
id:'check_result_enter',
fieldLabel:'质检结果',
blankText:"输入或选择",
emptyText:"请选择",
store:checkResultStore,
mode:'remote',
displayField:"text",
valueField:"value",
editable:true,
typeAhead:true,
enableKeyEvents:true,
forceSelection:false,
selectOnFocus:true,
triggerAction:'all'
} ]
}
);</script>extjsajax comboeditable覆盖
id:'check_result_enter',
fieldLabel:'质检结果',
blankText:"输入或选择",
emptyText:"请选择",
store:checkResultStore,
mode:'remote',
displayField:"text",
valueField:"value",
editable:true,
typeAhead:true, 去掉试试
enableKeyEvents:true,
forceSelection:false,
selectOnFocus:true,
triggerAction:'all'