aotocomplete

/*==========加载时执行的语句==========*/  $(function () {      $.getJSON("JsonHandler.ashx", {}, function (json) {          initAutoComplete(json);      })  });  

 function initAutoComplete(json) {      $("#suggest1").autocomplete(json, {             minChars: 1,             matchCase: false, //不区分大小写"JsonHandler.ashx"             autoFill: false,             max: 10,             formatItem: function (row, i, max, term) {                // row = eval("(" + row + ")"); "JsonHandler.ashx"                 var v = $("#suggest1").val();                 return row.name + " (" + row.code + ")";                 if (row.code.indexOf(v) == 0 || row.spell.indexOf(v) == 0) {                     return row.name + " (" + row.code + ")";                 }                 else                     return false;             },             formatMatch: function (row, i, max) {               //  row = eval("(" + row + ")");                 return row.name + " (" + row.code + ")";             },             formatResult: function (row) {                // row = eval("(" + row + ")");                 return row.name + " (" + row.code + ")";             },             reasultSearch: function (row, v)//本场数据自定义查询语法 注意这是我自己新加的事件             {               //  row = eval("(" + row + ")");                 //自定义在code或spell中匹配                 if (row.data.code.indexOf(v) >= 0 || row.data.spell.indexOf(v) >= 0||row.data.name.indexOf(v)>=0 ) {                     return row;                 }                 else                     return false;             }         });     }

posted on   静欲动  阅读(148)  评论(0编辑  收藏  举报

导航

< 2013年1月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2
3 4 5 6 7 8 9

统计

点击右上角即可分享
微信分享提示