Open phani1kumar opened 7 years ago
I just found the same problem. Did you find any workaround @phani1kumar?
Okay, here's what you can do for the time being. Whenever the value of _calculatePageVisibility(user)
changes you have to make two calls on your iron-pages
:
_updateItems()
to discover items that match the selector_updatSelected()
to make sure you select/unselect an item in case its visibility should changeYou may also want to wrap those calls in this.async
(Polymer 1.x) or Polymer.Async.microTask.run
in Polymer 2.0 to wait for bindings to set
Description
I am using Polymer #2.0-preview version
iron-pages changing the visible pages dynamically. I tried to achieve this by data binding the
selectable
attribute viaselectable="[[_calculatePageVisibility(user)]]"
inside the function I was doing the following:In debugger, I could see that the ironPage.selectable has changed as per the user state, but the ironPage.items is not getting updated. Please help me how to achieve this, and if I am doing something wrong in the process! (edited)
I've also tried to do the
ironPage.forceSynchronousItemUpdate()
in the_onUserChange
observer.still no luck! kindly help.
Expected outcome
On user login, and once the user property is set, the visible pages list should change because the
_calculatePageVisibility
function is selecting the pages based on user logged in or not. But the change is not reflecting though the selectable property is getting updated.Actual outcome
Once user logged in the visibility of the the pages change as expected by the selectable.
Steps to reproduce
iron-pages
element in the page.default
for 3 of them anduserOnly
for two of themselectable
attribute for iron-pages as the function_calculatePageVisibility
provided above._calculatePageVisibility
on some known user state (say a toggle button on the same page).Browsers Affected
Tested in Chrome and Firefox