动态搜索/过滤器核心列表(聚合物0.5) [英] Dynamic search/filter core-list (Polymer 0.5)

查看:56
本文介绍了动态搜索/过滤器核心列表(聚合物0.5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现一个过滤器类型的搜索,如果它们与搜索不匹配,则将其隐藏在核心列表中.我创建了一个.hidden类,如果表达式返回false,则该类将应用于项目:

I need to implement a filter-type search which hides items in core list if they do not match the search. I created a .hidden class that is applied to an item if an expression returns false:

class = {{ {hidden: !match(model.host, hQuery)} | tokenList }}

元素是隐藏的,但是除非单击可见行,否则列表不会重排元素.有没有办法使用函数调用来强制重排?

The elements are hidden, but the list does not reflow elements unless I click on a visible row. Is there a way to force a reflow using a function call?

推荐答案

经过一周的努力,隐藏列表项并不是解决此问题的正确方法.遍历原始数组,将所有匹配的对象推送到临时数组,然后将核心列表的.data数组替换为临时数组:this.$.list_id.data = tmpArray.对于列出多达1万条记录的情况,性能很好.

After a week of struggling, hiding list items is just not the right way to handle this. Iterate through the original array, push any matching objects to a temporary array, and then replace core-list's .data array with the temporary array: this.$.list_id.data = tmpArray. Performance is good for lists up to 10K records.

这篇关于动态搜索/过滤器核心列表(聚合物0.5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆