作者:多来哈米
如图,输入关键字,左匹配检索
HTML代码
1 <input class="easyui-combobox" name="userId" id="userId"data-options="valueField:'id',textField:'text',panelHeight:'auto',panelMaxHeight:200,panelMinHeight:100" style=" 160px;height: 29px"/> 2
js获取数据
1 $('#userId').combobox({ 2 prompt:'输入首关键字自动检索', 3 required:false, 4 url:'${path }/portal/designer/tree', 5 editable:true, 6 hasDownArrow:true, 7 filter: function(q, row){ 8 var opts = $(this).combobox('options'); 9 return row[opts.textField].indexOf(q) == 0; 10 } 11 });
组件最右边的选择框下拉箭头不美观,那么可以通过设置hasDownArrow:false将其去掉;
首先需要可以编辑,combobox默认的editable就是true