大佬教程收集整理的这篇文章主要介绍了jQuery UI自动完成不过滤数据,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用jQuery UI Autocomplete,它显示了json结果.所以我知道我的JSON是有效的.但是,它没有过滤任何东西.@R_832_9447@输入一个数字,它只显示所有数据.任何提示将非常感谢!
我很感激你的时间!
$.widget('custom.catcomplete',$.ui.autocomplete,{ _renderMenu: function(ul,items) { var self = this,currentCategory = ''; $.each(items,function(index,item) { if (item.category != currentCategory) { ul.append('<li class="ui-autocomplete-category">' + item.category + '</li>'); currentCategory = item.category; } self._renderItem(ul,item); }); } }); $('#category').catcomplete({ source: function(request,responsE) { $.ajax({ url: '/wp-content/plugins/pagelines-sections/searchbar/products.json',dataType: 'json',data: { term: request.term },cache: true,success: function(data) { response($.map(data.products,function(item) { return { category: item.category,label: item.label,value: item.value }; })); } }); },minLength: 1 });
以上是大佬教程为你收集整理的jQuery UI自动完成不过滤数据全部内容,希望文章能够帮你解决jQuery UI自动完成不过滤数据所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。