{ Beyond String Concatenation Using jQuery Templating to Cleanly Display Your Data.

Slides:



Advertisements
Similar presentations
EIONET Training Zope Page Templates Miruna Bădescu Finsiel Romania Copenhagen, 28 October 2003.
Advertisements

XHTML Week Two Web Design. 2 What is XHTML? XHTML is the current standard for HTML Newest generation of HTML (post-HTML 4) but has many new features which.
JQuery Mobile, UI and Templates A better way for developing mobile and desktop apps
SharePoint 2013 Catalog Sites Brian Culver ● SharePoint Saturday DFW ● March 7, 2015 Build a SharePoint 2013 Search Driven.
DEV-04 Building OpenEdge® Reference Architecture Applications with WebSpeed® Chris Skeldon Principal Consultant.
Razor. Slide 2 Remember this? Browser Web Server HTTP Request HTTP Response (Web page / code) Client code (script) Interpret request Generate HTML and.
1 The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP – The HyperText Transfer Protocol Performance Enhancements.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
Thanks to our Sponsors!  Platinum:  Gold:  Silver:  Raffle:
Micro Templates for Javascript Norman White. Background Separate HTML code from data Provide a flexible reusable template to generate html with embedded.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
Hilton Giesenow - The MOSS Show Building Rich Web Applications with ASP.NET AJAX, jQuery & the ACT SESSION CODE: WUX304.
Simon Amrein Consultant Trivadis AG What is ASP.NET 4.0 Ajax Ajax Control Toolkit Microsoft Ajax Content Delivery Network jQuery jQuery Client Templates.
It’s World Wide! I NTRODUCTION TO T HE WEB 1 Photo courtesy:
Overview of HTML. Three Different Approaches  Text editor like Notepad  HTML editor such as: –KompoZer –DreamWeaver –Microsoft Expression Web –iWeb.
Learning & Development Telerik Software Academy.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Using jQuery Templates with ASP.NET Stephen Walther Superexpert.com
Web Pages. WebMatrix Microsoft WebMatrix is a free tool (stack) from Microsoft that developers can use to create, customize, and publish websites to the.
SUNY Polytechnic Institute CS 490 – Web Design, AJAX, jQueryAngularJS AngularJS is a client-side JavaScript Framework for adding interactivity to HTML.
Learning & Development Telerik Software Academy.
Joel Bapaga on Web Design Strategies Technologies Commercial Value.
Homework for October 2011 Nikolay Kostov Telerik Corporation
UNIT 3 DYNAMIC WEBSITES WITH CSS AND JAVASCRIPT. OBJECTIVES  CO4 Apply style to a website using CSS.  CO5 Describe the use of scripting when creating.
Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Best Practices for Coding April 14, Best Practices Keep it simple –Plain Old Semantic HTML (POSH) Don’t recreate styles already in the EPA style.
Deep Dive on SharePoint Ribbon Development and Extensibility Chris O’Brien SharePoint MVP Independent OSP433.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Fundamentals, Ajax, Templates, UI Doncho Minkov Telerik Corporation
Jeff King Senior Program Manager Microsoft Session Code: WIA204.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Welcome to jQuery jQuery is one of many available libraries that – Provide functions for manipulating the web page With fairly good performance – Help.
HTML A brief introduction HTML1. HTML, what is? HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
Lesson 30: JavaScript and DHTML Fundamentals. Objectives Define and contrast client-side and server-side technologies used to create dynamic content for.
ASP.NET – Active Server Pages ASP.NET is a server-side technology for developing web applications based on the.NET Framework.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Jean-Claude Trachsel Senior Consultant, Trivadis AG The good news.
OVERVIEW OF CLIENT-SIDE SCRIPTING
JQUERY AND AJAX
Javascript AJAX HTML WEB SERVER Asynchronous. Javascript HTML events DOM – document object model browser internal view of html page compute.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
Wes Preston DEV 202. Audience: Info Workers, Dev A deeper dive into use-cases where client-side rendering (CSR) and SharePoint’s JS Link property can.
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
DEV103 – Web Part Transformers – More than meets the eye By: D’arce Hess.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.
Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
I NTRO TO W EB TECHNOLOGY Basic terms. C LIENT – S ERVER M ODEL a distributed communication between service requestors and service providers.
Advanced Topics in Concurrency and Reactive Programming: React
Autodesk® PLM 360 Developer's Delight:
Unleash the Power of jQuery
ASP MVP Web applications and Razor
KnockoutJS -Pradeep Shet 31st August 2014.
HTML A brief introduction HTML.
Advanced Topics in Concurrency and Reactive Programming: React
Overview of HTML.
Secure Web Programming
JavaScript CS 4640 Programming Languages for Web Applications
Client-Server Model: Requesting a Web Page
Bootstrap Direct quote from source: bootstrap/
JavaScript CS 4640 Programming Languages for Web Applications
SharePoint Saturday Kansas City October 19, 2019
Presentation transcript:

{ Beyond String Concatenation Using jQuery Templating to Cleanly Display Your Data

Rey Bango jQuery Team Member Microsoft Client-Web Community PM Editor of ScriptJunkie.com Ajaxian.com Writer Co-host of the jQuery Podcast Co-host of JSConf Live Podcast

Web Templates

Not a New Invention Server-side for years ASP.NET Smarty & Savant (PHP) Cheetah & Mako (Python)

Awesome-Sauce Separates content and program code Flexible architecture Shortens development time Readability Great for teams

Damnit DOM! DOM Manipulation x1000 HTML Concatenation Soup Readability Hell Maintenance – Needles in eyes

var clRec = ""; for(var i=0; i<clientData.name.length; i++) { clRec += " " + clientData.name[i] + " "; clRec += " " + clientData.name[i] + " ";}$("ul").append(clRec); HTML Soup

${name} ${name} </script> $(“#clientTemplate”).tmpl(clientData).appendTo( “ul” ); No Soup for You!

Clarity Affect the UI via pre-built templates Nice well-defined structure Less convoluted and hard to understand code Greater maintainability

Templates Good Separates UI from data JavaScript and HTML-based. Easy! JavaScript templates are rendered and cached client-side Promotes reusability of existing templates Designers & developers can coexist <3

Aren’t server-side templates good enough?

JS Engines JavaScript Micro-Templating jTemplates PURE mustache.js jQuery Smarty jQuote

jQuery Templating 1 st contribution from Microsoft MIT/GPL – Just like jQuery Official Plugin supported by the jQuery Project

Data Template Templating Engine DOM

var tmpl = " ${ dataItem } "; A Template

${ dataItem } ${ dataItem } </script> A Template

${Name} ${Name} Price: ${formatPrice(Price)} Price: ${formatPrice(Price)} <img data-pk="${Id}" src="Content/AddCart.png" <img data-pk="${Id}" src="Content/AddCart.png" alt="Add to Cart" class="addCart" /> alt="Add to Cart" class="addCart" /> </script> A Template

.tmpl() $("#myTemplate").tmpl( dataObject ).appendTo("ul"); ${ dataItem } ${ dataItem } </script> <ul></ul>

Code

Main Methods tmpl() tmplItem() template() - Render the template - Find the template item - Compile/Store a template

Supported Tags ${...} {{each...}}...{{/each}} {{if...}}...{{else...}}...{{/if}} {{html...}} {{tmpl...}} {{wrap...}}...{{/wrap}} - Evaluate fields or expression - Loop over template items - Conditional sections - Insert markup from data - Composition, as template items - Composition, plus incorporation of wrapped HTML

${parseInt(ReleaseYear) + 100} </script> Inline Expressions

${name} {{if (age > 30)}} is Old!{{/if}} Code Blocks

${name} ${name} {{if (age > 30)}} is Old!{{/if}} {{if (age > 30)}} is Old!{{/if}} {{tmpl($data) "#ageTemplate"}} {{tmpl($data) "#ageTemplate"}}</script> Current Age: ${age} Current Age: ${age} </script> Nesting

function addAge() { return this.data.age + 12; }…. Current Age: ${addAge} Custom Functions

var clientData = [ { name: "Rey Bango", age: 32, id: 1, phone: [ " ", " " ] },…]; ….<ul> {{each phone}} ${$value} {{/each}} </ul> Looping

Code

Make it Better!

Rate Me!

Rey