我在开发中有一个PhoneGap应用程序,我试图使用framework7的搜索栏来过滤出我的虚拟产品列表。Framework7虚拟列表searchAll函数没有被使用
当前的功能是列表工作正常,但搜索栏只搜索渲染的元素而不是整个虚拟列表。
我已经通过framework7的documentation让他们的虚拟列表和搜索栏一起工作,但据我可以告诉在我的代码中的搜索栏完全忽略虚拟列表searchAll功能,我把我可以searchAll ()返回任何东西,它对当前的功能没有任何影响。
var listObject = {
items: selectProd,
template: '<li class="item-content"><div class="item-inner"><div data-value="{{model_id}}" class="item-title list-title">{{internal_descriptn}}</div></div></li></script>',
searchAll: function (query, items) {
var foundItems = [];
for (var i = 0; i < items.length; i++) {
// Check if title contains query string
if (items[i].title.indexOf(query.trim()) >= 0) foundItems.push(i);
}
// Return array with indexes of matched items
return foundItems;
}
};
console.log(listObject);
var virtualList = myApp.virtualList('#product-list', listObject);
var mySearchbar = myApp.searchbar('.searchbar', {
searchList: '.list-block-search',
searchIn: '.list-title'
});
我觉得我可能缺少的仅仅是一些方法来把virtualList到搜索栏作为属性或类似链接它们,这似乎很奇怪,我期望他们就像魔一起工作。然而,这似乎是文件表明它所做的事情(显然不是我的情况,或者它会起作用)。谢谢你的帮助。