用于模糊查询
在租赁专柜接口,做账号管理的时候,有一个查询条件是专柜,这个时候用模糊查询,可以更方便的找到专柜,具体代码如下:
查询条件的input框:
<div class="search_condition">
<div class="search_title">专柜编码</div>
<div class="search_content ">
<input type="text" name="likecounter" id="likecounter" />
</div>
</div>
autocomplete插件的属性设置
$("#likecounter").autocomplete("<%=basePath%>likecounter.htm",{
minChars: 1,
dataType: "json",
cacheLength: 0,
width: 128,
max: 5,
matchContains: true,
selectFirst: true,
highlight: false,
investmentscheme:true,
formatItem: function(row, i, max) {
var name = row.COUNTER+"-"+row.USERNAME;
return name;
},
formatMatch: function(data, i, max) {
return data.COUNTER+"-"+data.USERNAME;
},
parse: function(data) {
return $.map(data, function(row) {
var id = row.COUNTER+"-"+row.USERNAME;
return {
data: row,
value: id,
result: id
};
});
},
formatResult: function(row) {
return row.COUNTER+"-"+row.USERNAME;
},
});
网友评论