You need to use Polymer's array helper methods so the template bindings see the changes.
https://www.polymer-project.org/1.0/docs/devguide/properties.html#array-mutation On Tue, Aug 4, 2015, 10:44 PM Hans Dulimarta <[email protected]> wrote: > I'm having issue updating a polymer 1.0 template from a Parse.com > callback. This is my template: > <template is="dom-repeat" items="{{users}"> > <div><span>{{item.name}}</span><div> > </template> > > > and this is my Parse.com query and callback: > Polymer({ > is: "my-element", > users: [{name : "It's me"}], > ready: function() { > var userObj = Parse.Object.extends("Users"); > var userQuery = new Parse.Query (userObj); > userQuery.find().done(this.userLoaded.bind(this)); > }, > > userLoaded:function(results) { > for (var i = 0; i < results.length; i++) { > var userData = results[i]; > this.users.push({name: userData.get("name")}); > } > } > ) > > I verified with the debugger that inside userLoaded each element of the > results array was correctly pushed to this.users. However, the template > shows only one item ("It's me"), the other items returned by the > Parse.query did not show up on the template. > > I'm guessing that I misunderstood the function scoping details of either > parse.com callback and polymer functions. > > 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/c2b76cd2-03f5-4a61-b32d-452d22e0f454%40googlegroups.com > <https://groups.google.com/d/msgid/polymer-dev/c2b76cd2-03f5-4a61-b32d-452d22e0f454%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > 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/CACGqRCCqU9E8zuxa2iocd2%3Dqmr-cRMFeZ2ysHZgicYPcFv5HaQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
