tag:blogger.com,1999:blog-3627888979577168137.post5219992015095126253..comments2023-03-26T00:54:12.803-07:00Comments on Dancing with Data: jQuery Templates is now an Official jQuery PluginBoris Moorehttp://www.blogger.com/profile/17923416771395046921noreply@blogger.comBlogger61125tag:blogger.com,1999:blog-3627888979577168137.post-83692786664104531332016-10-03T14:45:02.840-07:002016-10-03T14:45:02.840-07:00If by empty template, you mean you want to render ...If by empty template, you mean you want to render the template, but without passing data, You can simply pass {} as first parameter:<br />('#tmpl').tmpl({}, {index:var}).<br />That said, I would encourage you to switch to JsRender which is much more complete, and is actively maintained. jQuery Templates is no longer maintained/supported so I will be unlikely to be able to reply to specific questions of this kind, moving forward...<br />Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-53639891208635496112016-10-03T03:36:28.940-07:002016-10-03T03:36:28.940-07:00Hi I have a scenario where I have to use my variab...Hi I have a scenario where I have to use my variable in an empty tmpl. Your solution of adding external variable works for tmpl where I have a list of data but not for above scenario. Do you have a way in which i can read a variable. <br />('#tmpl').tmpl(list,{<br />index:var}); is working<br />('#tmpl').tmpl({<br />index:var}); is not workingAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-90057630336080450272014-07-23T15:37:13.367-07:002014-07-23T15:37:13.367-07:00jQuery loadTemplate is nothing to do with jQuery T...jQuery loadTemplate is nothing to do with jQuery Templates. jQuery Templates are here: <a href="https://github.com/BorisMoore/jquery-tmpl" rel="nofollow">https://github.com/BorisMoore/jquery-tmpl</a>. But the project is no longer maintained, and is superseded by JsRender (for templates) and JsViews (for templates with data-binding, single page applications etc.) See <a href="http://www.jsviews.com/#jsrender" rel="nofollow">http://www.jsviews.com/#jsrender</a>, <a href="http://www.jsviews.com/#jsviews" rel="nofollow">http://www.jsviews.com/#jsviews</a>. Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-73042449682572932272014-07-22T23:31:52.299-07:002014-07-22T23:31:52.299-07:00I am using jquery loadTemplate for single page app...I am using jquery loadTemplate for single page application. Facing issue with radio button and checkbox grouping. Only one checkbox/redio button is getting checked. All others of the same group are getting clicked but not checked at all.<br /><br />Any suggestion highly appreciated. <br /><br />ThanksAnonymoushttps://www.blogger.com/profile/01369499971547973771noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-77265522194253194142013-01-21T09:29:10.256-08:002013-01-21T09:29:10.256-08:00@Natalya: jQuery Templates is now managed by the j...@Natalya: jQuery Templates is now managed by the jQuery UI team, and they have decided not to support it any more. For some background on this, see: <a href="http://www.borismoore.com/2011/10/jquery-templates-and-jsviews-roadmap.html" rel="nofollow">jQuery Templates and JsViews: The Roadmap"</a>. Recently they decided to also remove the documentation from the jQuery API site (though a lot of people are of course using it). <br /><br />I am no longer working on jQuery Templates, but rather on <a href="https://github.com/BorisMoore/jsrender" rel="nofollow">JsRender</a> and <a href="https://github.com/BorisMoore/jsviews" rel="nofollow">JsViews</a>, which are in fact the next-generation of jQuery Templates. <br /><br />There have been a number of requests to jQuery to add the jQuery Templates documentation back in to the API site - or at least on the readme. See <a href="https://github.com/jquery/jquery-tmpl/issues/173" rel="nofollow">github.com/jquery/jquery-tmpl/issues/173</a>. If you want to join in making that request, you could get in contact with the jQuery UI team, and/or add comments to that issue.Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-63591917384227210932013-01-21T01:49:07.855-08:002013-01-21T01:49:07.855-08:00Hello,
Why the documentation for the jQuery Templ...Hello,<br /><br />Why the documentation for the jQuery Templates plugin is not available on the jQuery API site at http://api.jquery.com any more?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-30884555057878926532012-02-12T12:47:32.870-08:002012-02-12T12:47:32.870-08:00Got it fixed. The problem was that the network at...Got it fixed. The problem was that the network at the VA did not like non-encrypted ajax requests that employed a non standard script type for the javascript block. Once we put SSL on the whole site, the problem went away. I'm guessing some here, but putting the whole site on SSL fixed it.Anonymoushttps://www.blogger.com/profile/02323310898434133232noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-76839509292232973392012-02-07T07:45:10.266-08:002012-02-07T07:45:10.266-08:00The same thing happens with the newer JSRender and...The same thing happens with the newer JSRender and JSView. This is baffling. I'm wondering if the script type="text/x-jquery-tmpl" is banned from VA hospital locations (They all share the same network setup). I'm starting to wonder if I should have the DOM built elsewhere and the pushed back into the page so it can be a regular jquery call. Hate to do that kind of a hack just for one location.Anonymoushttps://www.blogger.com/profile/02323310898434133232noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-31990667608185491552012-02-06T14:04:41.219-08:002012-02-06T14:04:41.219-08:00@Jon Wear: No idea, but it sounds like it is not a...@Jon Wear: No idea, but it sounds like it is not an issue with the templates themselves. If the data is there, then either the data returned is different when the request is going from that location, or the browser settings are different.Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-74682269510130220772012-01-31T07:38:18.878-08:002012-01-31T07:38:18.878-08:00Hello Boris,
I know that the tmpl library is bei...Hello Boris, <br /><br />I know that the tmpl library is being phased out, but I have one question for you...<br /><br />I have a website that makes extensive use of your plugin and it works great everywhere, except any VA hospital. I've been able to trace it down to the line that does the .appendTo(template stuff):<br /><br />$("#tmpl-Comment").tmpl(results).appendTo("#divComments");<br /><br />I can see in the response object that the data does come back. It works in all browsers in every other location, but it doesn't work in IE, Chrome or FF from a VA hospital (this happens at one in San Diego and one in Philadelphia). <br /><br />Any ideas?Anonymoushttps://www.blogger.com/profile/02323310898434133232noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-56652707160173302572011-11-12T12:18:33.409-08:002011-11-12T12:18:33.409-08:00@lujan99: Note that jquery.tmpl.js functionality i...@lujan99: Note that jquery.tmpl.js functionality is factored (in the ongoing implementation) into JsRender and JsViews. The DOM integration, data linking and view context features are provided by JsViews, which is a layer on top of the JsRender template rendering implementation. A view in JsViews is effectively equivalent to a template item in jquery.tmpl.js.Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-11269645506138190302011-11-12T12:13:46.946-08:002011-11-12T12:13:46.946-08:00@lujan99: See examples here: http://borismoore.git...@lujan99: See examples here: <a href="http://borismoore.github.com/jsviews/demos/index.html" rel="nofollow">http://borismoore.github.com/jsviews/demos/index.html</a>. $(this).tmplItem() corresponds to $(this).view() (or $.view(this)...)Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-7380451563030106632011-11-12T04:09:49.880-08:002011-11-12T04:09:49.880-08:00I want to port my code to JsRender , how can I app...I want to port my code to JsRender , how can I apply code like $(this).tmplItem() ...with JsRender ?lujan99https://www.blogger.com/profile/08981264407740529079noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-65892152791203343112011-10-14T10:23:35.951-07:002011-10-14T10:23:35.951-07:00@Lynn: yes, it is unfortunate. But on the plus sid...@Lynn: yes, it is unfortunate. But on the plus side, I think JsRender will be better still. You could port right now to JsRender of course. I know it has the same issue for you of being (pre) Beta software, but it should move quite fast now towards a release version (unlike jQuery Templates) and I think the API is fairly close to stable already...Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-74369844652342291882011-10-14T05:52:17.991-07:002011-10-14T05:52:17.991-07:00verrrrry disappointing to hear that jQuery Templat...verrrrry disappointing to hear that jQuery Templates is not being further worked on. I think this is an excellent, much-needed, part of the jQuery framework. Without templating, we're just using string concatenation and loops to build the presentation from JSON data. <br /><br />I used the jQuery template plugin for some work here at my job. My manager told me to remove it because it's Beta, and not supported. Now I have to spend at least a day manually building the DOM with jQuery. It is a shame.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-77930326037298870052011-09-06T18:04:24.829-07:002011-09-06T18:04:24.829-07:00@thgsb, @Oleg and @HKL: Yes, the template plugin i...@thgsb, @Oleg and @HKL: Yes, the template plugin is now owned by the jQuery UI team. Ongoing work on jQuery Templates is happening at <a href="https://github.com/BorisMoore/jsrender" rel="nofollow">https://github.com/BorisMoore/jsrender</a> and <a href="https://github.com/BorisMoore/jsviews" rel="nofollow">https://github.com/BorisMoore/jsviews</a>. <br /><br />The jQuery UI team have decided that development on <a href="https://github.com/jquery/jquery-tmpl" rel="nofollow">https://github.com/jquery/jquery-tmpl</a> will not continue. They will instead use a new jQuery templates implementation which will be JsRender (or based closely on JsRender). They may also use the integrated templates and data-linking provided by JsViews. <br /><br />See the upcoming presentation at the jQuery Conference: <a href="http://events.jquery.org/2011/boston/schedule/" rel="nofollow">http://events.jquery.org/2011/boston/schedule/</a>.<br /><br />I'm not sure yet what the detailed roadmap is - when JsRender and JsViews will move to Beta. Hopefully we will be able to define that soon...Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-60761299820562524992011-09-06T06:14:11.379-07:002011-09-06T06:14:11.379-07:00As I read in the jQuery Blog http://blog.jquery.co...As I read in the jQuery Blog http://blog.jquery.com/2011/04/16/official-plugins-a-change-in-the-roadmap/ the template plugin was adopted by the jQuery UI team.HKLhttps://www.blogger.com/profile/18087763262200098303noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-14525151348963602522011-08-25T03:15:37.029-07:002011-08-25T03:15:37.029-07:00Hi Boris,
Are jquery.templates already in the sou...Hi Boris,<br /><br />Are jquery.templates already in the source code of 1.6? And if not - when could we expect that? (and could we?)<br /><br />ThanksOleghttps://www.blogger.com/profile/12122884496162765817noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-51386294132499930112011-08-24T14:52:50.949-07:002011-08-24T14:52:50.949-07:00When is this projected to move out of Beta? I'...When is this projected to move out of Beta? I'd like to use it, but don't want to commit before it's at least v1.0. I see you've not contributed to it on github for over 2 months now. Has development stalled?Anonymoushttps://www.blogger.com/profile/15663634101252672135noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-55176589984611948632011-06-22T22:28:55.607-07:002011-06-22T22:28:55.607-07:00@Mike: ${$data["autn:term"]}, or ${$data...@Mike: ${$data["autn:term"]}, or ${$data['autn:term']} should work.Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-53001661512111564662011-06-22T13:38:02.621-07:002011-06-22T13:38:02.621-07:00I'm having an issue where I'm unable to di...I'm having an issue where I'm unable to display the value of a key that contains a colon.<br /><br />For example, my JSON string contains keys that all have a colon:<br /><br />i.e. { "autn:term" : "value" }<br /><br />I've verified and tested that the JSON string is good/valid, so no issues there. However, when I attempt to spit out the content onto my page, this does not work:<br /><br />${autn:term}<br /><br />I've tried escaping it in various ways, all have been unsuccessful. The only way I could get it to work was by renaming the key value to NOT have a colon. Since this feed is coming from a third-party, I do not have the luxury of changing this, so I'll need to find a solution with what I've got. <br /><br />Any ideas?Mikehttps://www.blogger.com/profile/11782853064699546622noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-5304304926640826382011-04-08T18:03:14.645-07:002011-04-08T18:03:14.645-07:00@Matt:
Yes, it is by design that if Text is of typ...@Matt:<br />Yes, it is by design that if Text is of type function, ${Text} will call the function. It was designed that way for consistency with similar patterns in jQuery. For example if you do $( element ).attr( "Title", foo ) and foo is a function, then the attribute will be set to the value returned by foo. <br />But that said, I am not a fan of this design, in the case of expression evaluation within templates, and I am expecting that in Beta2 onwards, the parens will be required if you want ${Text()}to call the function... But the fact remains that if you don't have a field called Text on your data, it will 'see' any globally defined variable of the same name, and use that instead... So you will still need to be aware of possible collisions, if you have fields which are not always defined on the data...Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-73740277471114197492011-04-07T20:45:16.443-07:002011-04-07T20:45:16.443-07:00Hi there...
I recently got bitten by trying to us...Hi there...<br /><br />I recently got bitten by trying to use the variable "Text" in one of my templates, as in ${Text}. I eventually figured out that it was calling the native global browser function Text().<br /><br />Is there any particular reason why ${Text} and ${Text()} both try to call Text()? I would have thought that you'd require the user to add the parenthesis if the user intended to call a function.<br /><br />Cheers,<br /><br />MattMatt Parlanehttps://www.blogger.com/profile/06747990231435673659noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-27743966900702394392011-03-23T13:31:17.467-07:002011-03-23T13:31:17.467-07:00Yes, you can update just the content of a nested t...Yes, you can update just the content of a nested template. There is even an .update() method on the tmplItem, to make scenario easy. See for example the movies sample, which does it in several places: <a href="https://github.com/jquery/jquery-tmpl/blob/master/demos/movies/PagesCore/movies.html" rel="nofollow">PagesCore/movies.html</a>. For updating the ${HEADER} content without using template, you should take a look at data linking: <a href="https://github.com/jquery/jquery-datalink" rel="nofollow">github.com/jquery/jquery-datalink</a>.Boris Moorehttps://www.blogger.com/profile/17923416771395046921noreply@blogger.comtag:blogger.com,1999:blog-3627888979577168137.post-89358177144821668942011-03-14T03:36:23.482-07:002011-03-14T03:36:23.482-07:00Hi Boris,
first, i want to thank you for this awes...Hi Boris,<br />first, i want to thank you for this awesome plugin.<br /><br />i have some question about it though. <br /><br />first, is there any way to do partial template update? <br /><br />lets say i have this as template<br /><br /><div><br /> <span>${HEADER}</span><br /> <div>${CONTENT}</div><br /></div><br /><br />now i need to only update the <span> tag, i don't want the <div> of content get re-rendered because some changes are made there.<br /><br /><br />second, using the template tag {{tmpl}}, how can i render data from nested template?<br /><br />here's the case<br /><br /><div><br /> {{tmpl "<span></span>"}}<br /> <div>${CONTENT}<div><br /><div><br /><br />i want to achieve the same result as the first template i described earlier<br />using {{tmpl}} tag, any clue?<br /><br /><br />thanks alotTris Setiawanhttps://www.blogger.com/profile/17741740588747107810noreply@blogger.com