Viktor
Viktor

Reputation: 205

Polymer dom-if doesn't restamp computed condition under dom-repeat

So I have a scenario:

<template is="dom-repeat" items="{{objects}}" as="o" filter="{{_filter(filter)}}">
  ...
  <template is="dom-if" if="_isHidden" restamp>
    foo
  </template>
  ...
</template>

Now, the _filter function forces rerendering items under the dom-repeat every time my filter property changes (since it's observed by _filter. This is not the problem as it works properly, but the catch is that the _hidden function might return true or false based on another property (which could also change), and whenever the filter rerenders I need to force re-evaluation of _isHidden hence hide or show the contents of the dom-if template.

Anyone has an idea what could be my issue?

Thanks!

Upvotes: 1

Views: 755

Answers (1)

webmonkey
webmonkey

Reputation: 1093

You have to also bind the _isHidden property:

<template is="dom-repeat" items="{{objects}}" as="o" filter="{{_filter(filter)}}">
  ...
  <template is="dom-if" if="{{_isHidden}}" restamp>
    foo
  </template>
  ...
</template>

Upvotes: 1

Related Questions