자동 매칭 autocomplete
1921 단어 자동 일치
$(function(){
//
var onAutocompleteSelect = function(value, data) {
//var str = value.split(" ")[0];
document.getElementById("doctitle").value = value;
/*var datas = $.evalJSON(data);
document.getElementById("sbmc").value = datas.fixDevicename;// 1
document.getElementById("sbpp").value = datas.fixBrand;// 2
document.getElementById("sbxh").value = datas.fixBrand;// 3 */
}
var options = {
serviceUrl:"<%=AppUrl%>/common.do",
minChars:1,
onSelect:onAutocompleteSelect,
params: {
tblname:"documentinfo",
formaction:"matchtitle"
},
deferRequestBy: 0
};
var a = $('#doctitle').autocomplete(options);
a.enable();
//
});
2.//자동 일치 검색 작업 if (formaction.equals("matchtitle")) {
String keyword = StrUtil.checkNull(session.getRequest().getParameter("query"), "-1");
try {
// , javascript escape ,
keyword = URLDecoder.decode(keyword, "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String hql = " from DocumentInfo WHERE bt like '%"
+ keyword + "%' " + " ORDER BY xh ASC";
String docTable = DocumentInfoManager.getDocTitleJson(hql, keyword);
session.getRequest().setAttribute("ResultXml", docTable);
ar = new ActionResult("/success.jsp?isajax=true", "");
}