This section describes the use cases for render: https://www.polymer-project.org/1.0/docs/devguide/templates#synchronous-renders
Most common use case is probably re-running the sort and/or filter functions when an external piece of data changes. But there are a couple of other uses, like unit testing. Another example is in the iron-doc-viewer element that displays Polymer API docs. It has a set of dom-repeats that render properties, methods, and events. When you follow a direct link to an API page, like: https://www.polymer-project.org/1.0/docs/api/dom-repeat#method-render It needs to make sure those repeats are all rendered before it tries to scroll to the chosen anchor. (It actually uses Polymer.dom.flush() in this case, but it has the same effect, which ensuring that the templates have rendered.) So, in summary: - It doesn't do anything to change the dom-repeat's view of the data. If you want to notify the dom-repeat that some arbitrary data in your array has changed, your best bet is to do a shallow clone of the array: this.myArray = this.myArray.slice(); - It does ensure that rendering is done by the time it returns, which can be useful for unit testing, or scrolling to an element generated by the dom-repeat. - It forces the dom-repeat to re-run its sort and filter functions, even if it doesn't appear that anything has changed. Hope that helps. Arthur On Tue, Nov 1, 2016 at 5:44 AM, Quang Le <[email protected]> wrote: > Thank you > > I did know how to make the change as you suggested (if you look at my > whole code) > I just want more detail on what the *render *function actually does, in > order to use it properly. > > > On Tuesday, November 1, 2016 at 12:37:05 PM UTC+7, Karl Tiedt wrote: >> >> Because you are by passing the binding functionality of Polymer for >> Objects and Arrays... Because Polymer does not use mutation observers due >> to performance issues Objects and Arrays have to be notified of changes, >> this is done by using this.set as described very clearly in the >> documentation. The below method with the single line, is enough to get what >> you expected. >> >> // call dom-repeat render >> _renderDREmployees: function() { >> this.set('employees.0.name',"RENDERED"); >> }, >> >> -Karl Tiedt >> > 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/98c66ef0-90af-4d85-8cd0-6f53b06c8f4e%40googlegroups.com > <https://groups.google.com/d/msgid/polymer-dev/98c66ef0-90af-4d85-8cd0-6f53b06c8f4e%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/CADSbU_x-jFgDCDbP-Oz%3DPqtu3vToN94NbrZnZLehWGWza3hUOA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
