| Page 1 of 1 | [ 3 posts ] |
|
Some background: I'm coming from Prototype and am used to using Prototype's Template class for doing repeated updates from a stored template. Y.substitute seems like the correct method to use for this, but I'm having trouble wrapping my head around it.
Is there an example of using the third argument, the function callback, in the wild? Also, I noticed that substitute doesn't play well with YUI 3's OOP infrastructure, e.g. [gist=391551]Substitute doesn't get properties of YUI objects.[/gist] Any advice on making these two work together better, rather than writing a toObject() serializer? Edit: Here's the gist. Unsure why it's not working inline. |
|
Re: your gist:
It's because test.foo doesn't exist (foo is an attribute, not a .property). You can change your last substitute call to: Y.substitute("{foo}", test.getAttrs()) getAttrs() is effectively your toObject() serializer in this case. Hope that helps, Satyen |
|
Thanks, that's a big help. We're still struggling with using more complex templates (e.g. accessing properties of properties), but this works for subclasses of Y.Base.
|
| Page 1 of 1 | [ 3 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group