jquery autocomplate 清除缓存数据

  <script type="text/JavaScript">
         function Autocomplete() {

             var schoolId = $('#ddlFx').combobox('getValue');
             var data= $.Invoke('GetZxs', parseInt(schoolId)); //根据帅选条件查询数据

            $("#控件Id").flushCache();            //刷新缓存(非常重要)
            $("#控件Id").autocomplete(data, {
                 minChars: 1,      //自动完成激活之前填入的最小字符
                max: 15,          //列表里的条目数 0表示不限制
                width: 300,       //提示的宽度,溢出隐藏
                scrollHeight: 300,//提示的高度,溢出显示滚动条
                matchContains: true,//包含匹配,就是data参数里的数据,是否只要包含文本框里的数据就显示
                autoFill: false,    //自动填充
                //mustMatch: true,
                 parse: function (data) {
                     return $.map(eval(data), function (row) {
                         return {
                             data: row,
                             value: row.fId,
                             result: row.fName
                         }
                     }); //对ajax页面传过来的数据进行json转码
                },
                 formatItem: function (row, i, max) {
                     //return i + "/" + max + ": \"" + row.fName + "\" [" + row.fId + "]";
                     return row.fName ;
                 },
                 formatMatch: function (row, i, max) {
                     return row.fName;
                 },
                 formatResult: function (row) {
                     return row.fName;
                 }
             });


             //$("#txtzixun").result(function (event, row, formatted) {
             //    $('#txtzixunId').val(row.fId);  //隐藏控件存ID
             //    return row.fId;
             //});
         }


     </script>

 

posted @ 2017-04-28 16:23  lifangxia  阅读(453)  评论(0编辑  收藏  举报