How to re-run dom-repeat with sorting when changing the bool property in a Polymer element

How can I repeat the sorting and rendering of an element when something has changed in my element or when I want from code or automatically? Thanks you

<template is="dom-repeat" items="[[attachments]]" as="attach_item" sort="_sortItems"></template>
0
source share
1 answer

You need to set an observer for the fields you want to view.

Quoted from polymer documents:

By default, filtering and sorting functions are performed only when the array itself is mutated (for example, by adding or removing elements).

, , , .

:

<template is="dom-repeat" items="{{employees}}"
filter="isEngineer" observe="type manager.type">

: https://www.polymer-project.org/1.0/docs/devguide/templates.html#filtering-and-sorting-lists

PS: , this.set( "array.index.field", ),

+2

Source: https://habr.com/ru/post/1663558/


All Articles