Boris Moore<br />JsViews: Next-generation jQuery Templates and Data Link<br />
jQuery Templates – where is it going?<br />Next-generation jQuery Templates is separated into:<br />JsRender:Pure string-b...
Where does it live?<br />jQuery templates: https://github.com/jquery/jquery-tmpl <br />‘owned’ by jQuery UI, but supersede...
Roadmap?<br />jQuery templates: <br />Remain at Beta. <br />JsRender:<br />Soon move to Beta – then on to V1<br />will be ...
What we’ll see…<br />High-level summary of JsRender<br />High-level summary of JsViews<br />‘Crash course’ of demos, stepp...
JsRender?...<br />Really fast: as fast as fastest… <br />Fast compilation<br />Fast rendering -~20 times faster than jquer...
…JsRender?<br />…<br />Renders directly to string<br />var  html = $.render( myTemplate, myData );<br />$( "#container" )....
JsViews?...<br />View Hierarchy<br />A view is a rendered template ($.tmplItem -> $.view)<br />Nested templates are childr...
…JsViews?...<br />…<br />Incremental rendering when data changes<br />Add item to an array: JsViews inserts new <tr><br />...
…JsViews?<br />…<br />Integration with jQuery plugins<br />{{datepickerdateFormat="DD, MM d, yy"}}<br />Separation of conc...
Demos<br />‘Crash course’ of demos, stepping through the basics…<br />
References<br />jQuery Templates:<br />https://github.com/jquery/jquery-tmpl/ <br />JsViews:<br />https://github.com/boris...
Upcoming SlideShare
Loading in...5
×

JsViews - Next Generation jQuery Templates

20,033

Published on

Come and see the future of jQuery Templates, as it moves from Beta1 towards a V1 product. The new jQuery Templates is taking two forms: JsRender – lean and mean, for fast rendering of templates as strings, and JsViews – for powerful interactive browser apps in which Data Link and Templates work hand-in-hand. See how with declarative data linking and templating together, creating powerful data-driven UI is easy, whether using MVVM patterns or binding directly to JSON, and whatever the richness or complexity of the underlying data.

jQuery UI is already building its future data-bound widgets on top of this technology. With JsViews and JsRender integration between jQuery UI controls and your own data and UI becomes trivially straightforward.

Published in: Technology, Business
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
20,033
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
132
Comments
0
Likes
14
Embeds 0
No embeds

No notes for slide

JsViews - Next Generation jQuery Templates

  1. 1. Boris Moore<br />JsViews: Next-generation jQuery Templates and Data Link<br />
  2. 2. jQuery Templates – where is it going?<br />Next-generation jQuery Templates is separated into:<br />JsRender:Pure string-based template rendering, without DOM or jQuery dependency<br />JsViews:Interactive data-driven views, built on top of JsRender templates<br />
  3. 3. Where does it live?<br />jQuery templates: https://github.com/jquery/jquery-tmpl <br />‘owned’ by jQuery UI, but superseded by JsRender and JsViews<br />JsRender: https://github.com/BorisMoore/jsrender<br />JsViews: https://github.com/BorisMoore/jsviews<br />
  4. 4. Roadmap?<br />jQuery templates: <br />Remain at Beta. <br />JsRender:<br />Soon move to Beta – then on to V1<br />will be used by jQueryUI(TBD whether it will migrate to jQuery project in GitHub)<br />JsViews:<br />Move to Beta (after JsRender) and then on to V1 …<br />may also be used by jQueryUI<br />Current Usage<br />Avoided drawing attention to it until now (stabilization process)<br />Nevertheless JsViews and JsRender already being used by some teams within MS including Hotmail and Azure<br />
  5. 5. What we’ll see…<br />High-level summary of JsRender<br />High-level summary of JsViews<br />‘Crash course’ of demos, stepping through the basics…http://borismoore.github.com/jsviews/demos/jQueryConfDemosOct2011/index.html<br />
  6. 6. JsRender?...<br />Really fast: as fast as fastest… <br />Fast compilation<br />Fast rendering -~20 times faster than jquery.tmpl for simple templates<br />No DOM dependency (or even jQuery dependency)<br />can run on the server (node.js)<br />‘codeless’ syntax (similar to Mustache and Handlebars)<br />{{#each people}}<br /> <li>{{=Name}}</li><br />{{/each}}<br />no JS expressions in markupbut wait – there is a way…<br />…<br />
  7. 7. …JsRender?<br />…<br />Renders directly to string<br />var html = $.render( myTemplate, myData );<br />$( "#container" ).html( html );<br />Compiled template function simple to understand/debug<br />function( $data ) {<br />var result="<li> "+$data.name+"</li> ";<br /> return result;<br />}<br />Easy to create custom tags:<br />{{#sort people reverse="true"}}<br /> <li>{{=Name}}</li><br />{{/sort}}<br />
  8. 8. JsViews?...<br />View Hierarchy<br />A view is a rendered template ($.tmplItem -> $.view)<br />Nested templates are children of parent view<br />Interactivity<br />User actions change underlying data/model/view model<br />Changes are ‘observable’<br />Observable objects (property changes) and arrays (collection changes)<br />Changed via code or via declarative binding <br />Data binding expressions listen to changes<br />Declarative binding of values/arrays<br />- so changes to data automatically reflected by UI <br />…<br />
  9. 9. …JsViews?...<br />…<br />Incremental rendering when data changes<br />Add item to an array: JsViews inserts new <tr><br />Delete item: JsViews removes <tr><br />= Fast responsive UI… and no recycling of state on other rows in table… <br />Progressive enhancement support<br />Server rendering (JsRender): HTML rendered as string on server<br />Client activation: if javascript enabled and data available on client<br />UI will then respond to data changes, user actions…<br />…<br />
  10. 10. …JsViews?<br />…<br />Integration with jQuery plugins<br />{{datepickerdateFormat="DD, MM d, yy"}}<br />Separation of concerns<br />All code in registered helper functionsor in model/VM/presenter declarations<br />Custom tags for controls<br />{{#wizard step="1"}}<br /> ...<br /> {{/wizard}}<br />Declarative markup for MVVM, MVP …<br />
  11. 11. Demos<br />‘Crash course’ of demos, stepping through the basics…<br />
  12. 12. References<br />jQuery Templates:<br />https://github.com/jquery/jquery-tmpl/ <br />JsViews:<br />https://github.com/borismoore/jsviews/<br />Blog <br />http://www.borismoore.com/<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×