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

Array mutation without using helper methods #1666

Closed
benjyblack opened this issue May 29, 2015 · 1 comment
Closed

Array mutation without using helper methods #1666

benjyblack opened this issue May 29, 2015 · 1 comment

Comments

@benjyblack
Copy link

What's the recommended way to signal a change on an array when we're not using the helper methods? For instance, if I want to sort an array, what's the best way to let Polymer know something has changed? At the moment I'm using this.set('myArray', myArray.slice(0)); but is there a better way?

@kevinpschaaf
Copy link
Member

Note that dom-repeat supports filtering and sorting the view, such that for many use cases you don't need to mutate (sort/filter) the actual underlying array: https://www.polymer-project.org/1.0/docs/devguide/templates.html#filtering-and-sorting-lists

Right now, Polymer's array observation doesn't support observing in-place array sorts, so the workaround you are using is probably the best option at the moment if you absolutely need to sort the actual array for some app-specific reason.

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