Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Items do not update properly after 'attached' #105

Closed
cpboyd opened this issue Feb 3, 2016 · 5 comments
Closed

Items do not update properly after 'attached' #105

cpboyd opened this issue Feb 3, 2016 · 5 comments

Comments

@cpboyd
Copy link

cpboyd commented Feb 3, 2016

With paper-menu, I've tried adding paper-items to the menu after creation to no avail.

If the iron-selector could automatically update its item list, then it would be possible to utilize a JSON array (and a dom-repeat) to initialize an iron-selector element's items.

@notwaldorf
Copy link
Contributor

How are you adding your elements? This definitely works: http://jsbin.com/pusoja/1/edit?html,output
You need to make sure that you're using Polymer.dom(yourMenu).appendChild(newItem) instead of regular DOM methods, since the correct observers need to fire.

Closing, as this is working. Please re-open if you still have issues, and provide a JSBin with reproducible steps for your problem

@cpboyd
Copy link
Author

cpboyd commented Feb 3, 2016

@notwaldorf

I just realized that it seems the issue is more that paper-menu needs to override iron-selector's default functions, since paper-menu nests content within a div.

Polymer.dom(node).observeNodes() doesn't seem to monitor a child's children.

I've modified a behavior to account for this:
https://github.com/cpboyd/paper-menu-input/blob/master/paper-menu-input-behavior.html

By doing this, I'm able to easily add paper-items to the menu/menubar from a JSON array.

@notwaldorf
Copy link
Contributor

If you mean that iron-selector only tracks immediate children, then yes, you're right; this is being tracked in #42. :)

@cpboyd
Copy link
Author

cpboyd commented Feb 3, 2016

Ah. Thanks for that reference.

@notwaldorf
Copy link
Contributor

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants