Recursive jQuery Templates with custom functions causing stack overflow? -
I am creating a jQuery template system which essentially calls the same template as most examples of "recursive" templates There are only templates that are called other templates, even those that are also called templates. In this case, I want to call the same template with a sub-section of the original As the option parameter for the recursive call results in the data parameter is ignored, perhaps because Is there some other property there? You can not pass However I can not find a variable at $ data (AKA
$ item.data ), while custom templates Function passed in the original
tmpl call option.
// Original template call $ ("# someTemplate"). Tmpl (data, {someFunction1: function {itemToCheck} {returns item talker, PE;}, some function 2: function (moodcock) {return item tokak p1 + "," + itemtoocac .2;}}) .andendo (" result"); & Lt ;! - In-template secondary call - & gt; It seems that going through
$ item {{tmpl ($ data.sub, $ item), "#someTemplate"}}
$ item.data is the original object and it only adds new data parameters Overwrites as a result, at each recurring level, I'm still working on the original collar level in the object and the object structure Stack issue) have been no progress.
$ item pass only the custom function without overriding the template data given in the
$ item.data Need to use?
Update
$ item as an option parameter to
{{tmpl}} Are there. After this, this sets the
data for the new template call, and then it is replaced by the original
$ item.data via
jQuery.extend Removes from some lines later.
$ item Wrapping tasks, I was able to solve this problem by passing the original
$ item object in each custom function is not ideal, but it works.
{{tmpl ($ data.sub, {someFunction1: $ item.someFunction1, someFunction2: $ item.someFunction2}) "#semTemplate"}} < / Div>
Comments
Post a Comment