最近看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 : '未找到匹配的項' } }