forked from BorisMoore/jquery-tmpl
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved some private helper functions out of inner function scopes, for
memory optimization. Added support for white space after target in tmpl tag, e.g. ${ foo } or ${ foo(x) } Added support for targets that include '.'s and calls to functions, e.g. ${foo.toLowerCase()} Added support for implicit passing of $data to nested tmpl when no parameters, so that {{tmpl "#myTmpl"}} is equivalent to {{tmpl() "#myTmpl"}}, to {{tmpl(null) "#myTmpl"}}, and to {{tmpl($data) "#myTmpl"}}, and so allows myTmpl to bind to the same data as the parent template. (But {{tmpl(foo) "#myTmpl"}} or {{tmpl({}) "#myTmpl"}} will replace the inherited $data value.) Added support for inserting a template without data, using $( "#tmpl" ).tmpl(null).appendTo( "#container" ); - which is equivalent to $( "#tmpl" ).tmpl( {} ).appendTo( "#container" );
- Loading branch information
1 parent
8fc69f4
commit a702bbf
Showing
7 changed files
with
146 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update and Replace are not working for me anymore and I found out that it probably is because my ctxs array is empty. Before I updated to your latest version of jquery-tmpl, I did to add now things:
But when I check the
itemCtxs
afterwards, it is still empty now. How should I get a hold of these Ctxs now? Since it seems like I need them in a handy array to be able to use tmplCmd 'replace' and 'update' for example.a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newCtxs: itemCtxs feature has been removed for now. See:
http://github.com/nje/jquery-tmpl/commit/395b3593225f96c5325816d63c9f042a2a1310fc "Removed the newCtxs feature, to simplify implementation for appendTo"
It may come back in a future update, but in the meantime, take a look at the different movie samples, to show alternative ways of getting the ctxs array that you need.
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, missed that comment. Would an easy replacement be something like this?
Or is there more to the Ctxs array than that? Would be nice with some simpler more specific samples than that movie example. I find it a bit difficult to pull out things from it. For example it could be nice to just have a "sort" example and a "update one of several rendered items" and stuff like that. But I guess that comes with documentation and such when/if that comes?
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that should work fine, if you want the full set of rendered items, not just the last ones you appended. In most scenarios, e.g. appendTo under a container element, getting all the items will be what you want...
On more simple examples for the many different scenarios, yes, I agree. We hope to add them along with documentation, before too long...
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this commit has some issues, and should not be used. Instead, use the later updated version which replaces it:
http://github.com/nje/jquery-tmpl/commit/fbe824114bd494c20d642bb36ca0a57a6e659371
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Svish - that newCtxs feature is back in now, in the latest commit:
http://github.com/nje/jquery-tmpl/commit/a02d273a0dece498d6d2d9d0f1e24b37046e0c7e
a702bbf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BorisMoore - Thanks for letting me know!