> Is there any way to tell polymer to use an ArrayObserver in this case?
I have not been able to do this cleanly. Cleanest I've gotten is using an
extra variable together with ArrayObserver to trigger data recomputation.
Polymer team suggestion: it'd be very handy to have a way to manually
trigger recomputation of computed properties. It'd avoid the "extra var to
trigger changes" hack.
created: {
this.dataChanged = 0;
var obs = new ArrayObserver(this.data);
obs.open( function() { this.dataChanged++ }.bind(this));
}
computed: {
rows: "buildRows(data, numCols, dataChanged)"
}
On Thursday, January 15, 2015 at 1:19:46 AM UTC-8, Martin Kleinschrodt
wrote:
>
> Lets say I have a computed property like this:
>
> computed:{
> rows: "buildRows(data, numCols)"
> }
>
> Where 'data' is an array and I want 'rows' to be updated any time the
> anything in the 'data' array changes. Currently, polymer expressions uses a
> regular observer (path observer I think) to listen for changes to the
> 'data' object. Unfortunately, this means that the 'rows' property is only
> being updated when the 'data' array is replaced with a new object, not if
> elements are added or removed.
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/173ffc7e-39c7-4b86-a71b-ba35a360abbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.