How to filter an iron-list in polymer 1.0? -


the dom-repeat element offers filter attribute.

is there similar way filter iron-list?

for example: given list of people, want filter ones born in specific city.

as iron-list unfortunately doesn't offer filter attribute, there no declarative pattern making possible.

you can either implement own simple list element making use of dom-repeat's filter property. (with element inheritance coming in future releases, might extend iron-list).

however, best practice see use of computed property:

<template>   <iron-list items="[[filteritems(items)]]" as="item">     ...   </iron-list> </template>  <script> polymer({   ...   filteritems: function (items) {     return items.filter(function (item) { // array.prototype.filter       return item.priority > 8; // filter condition     });   } }); </script> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -