4

I've seen that Microsoft has created a official jQuery Template plugin for jQuery. But also jTemplates from what I've read is pretty popular. I didn't know if I should not bother with jTemplates and go straight to the jQuery Template or give jTemplates a go.

Any suggestions?

Note: it's my first time using any client-side templating framework.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
dotnetN00b
  • 5,021
  • 13
  • 62
  • 95

1 Answers1

5

I've been happily using jTemplates for a couple years, but absolutely recommend jQuery Templates going forward. Here are a few of the main reasons:

  • Other than using AJAX requests to load template definitions (which is easy to overcome), jQuery Templates is already as capable as jTemplates. In fact, I think jQuery Templates' {{tmpl}} tag for template composition is more intuitive and straightforward than jTemplates' #include.
  • Going forward, the massive community support and development around the "official" jQuery solution for templating will be hard to beat.
  • Since jQuery Templates will be rolled into jQuery core in 1.5, it doesn't make sense to include another template engine in addition to the one you're already getting for free with jQuery. I was told authoritatively that this would happen, but it now apparently will not happen by the 1.5 release at least. Sorry for any confusion.
Dave Ward
  • 59,815
  • 13
  • 117
  • 134
  • Thanks. Now I just need to get a good example of JSON and the JQuery Templates for ASP.NET Webforms. – dotnetN00b Nov 16 '10 at 16:21
  • The first link in my answer should help with returning JSON in a WebForms environment. Then, just substitute jQuery Templates for jTemplates, which is a relatively easy switch. You can learn about its specific syntax starting here: http://api.jquery.com/category/plugins/templates/ – Dave Ward Nov 16 '10 at 16:59
  • Another benefit to jQuery Templates is that the data used to populate the template is always available via the [.tmplItem()](http://api.jquery.com/tmplitem/) method. If jTemplates has similar functionality, I haven't seen it. – Joel Harris Mar 21 '11 at 20:07
  • It should be noted that jQuery Templates is no longer in active development. It is planned as a new feature for jQuery UI but is still in the planning stages. https://github.com/jquery/jquery-tmpl – Jason Towne May 23 '12 at 22:58