You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to polym...@googlegroups.com
Is there a way (event/method) to get a callback when a template based view has updated after the model changes?
Rafael Weinstein
unread,
Aug 8, 2013, 6:48:55 PM8/8/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Akhilesh Gupta, polymer-dev
There's no MDV-way to directly discover this (at the moment). You can
obviously use Mutation Observers to observe the DOM changing.
Can you say more about your use case?
On Thu, Aug 8, 2013 at 3:47 PM, <akhile...@gmail.com> wrote:
> Is there a way (event/method) to get a callback when a template based view
> has updated after the model changes?
>
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to polym...@googlegroups.com, Akhilesh Gupta
Sure. One use case is where I am trying to integrate my custom element's view, which is essentially a UL element generated and managed by MDV, with JQueryMobile to apply the styling. Now JQueryMobile needs to know whenever the children of my UL element change so that JQueryMobile can apply it's styles/events to those new elements. Basically I need to call something like $('ul').listview('refresh'); whenever my list view changes.
Without knowing when the DOM has updated, I can't properly guarantee the call to the $('ul').listview('refresh') of JQueryMobile. EmberJS has an "afterRender" queue to manage such situations where one can queue up the methods to be triggered after the DOM changes.
Rafael Weinstein
unread,
Aug 8, 2013, 7:07:06 PM8/8/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Akhilesh Gupta, polymer-dev
Got it.
So yes, I think Mutation Observers is a good fit here. When you have
this kind of timing dependency, it's best to depend explicitly on the
thing which you are waiting for. In this case it is new children of
the UL.
A MutationObserver should be very efficient and straightforward to
implement (if the elements you care about are always direct children,
you won't even need to do subtree observation).