您的位置:首页 > Web前端 > JQuery

Jquery autocomplete 插件 清除历史缓存数据

2016-06-24 10:28 591 查看
    <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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: