最近看extjs4的API发现combobox还有一个比较实用的功能,就是在combobox中输入比如"四川",就会自动查询当前下拉框中有的值并补齐成“四川省”,如果下拉框中的值很多的话这个方法还是比较实用。实用的方法也特别的简单,配置两个属性就行了:
{ xtype : "combobox", store : store, forceSelection : true,// 只能输入下拉框的中存在的值 typeAhead : true,// 允许自动选择匹配的生育部分文本 width : 110, id : 'setCity_province', queryMode : 'local', displayField : 'name', valueField : 'id', emptyText : '请先选择省份', listConfig : { emptyText : '未找到匹配的项' } }