Intro to Knockout.JS for Salesforce1
-
Upload
boris-bachovski -
Category
Software
-
view
171 -
download
3
description
Transcript of Intro to Knockout.JS for Salesforce1
![Page 1: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/1.jpg)
1
Introduction to KnockoutJS
![Page 2: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/2.jpg)
What We’re Going to Do
• Get our hands dirty with KnockoutJS• Some basic knowledge of Javascript, Apex and Visualforce
would be beneficial• We’re going to build a simple, fast, contact viewer
![Page 3: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/3.jpg)
KnockoutJS?
• KnockoutJS is a Javascript framework for building quick, single-page applications
• Requires less boilerplate that a lot of frameworks, and is conceptually simpler than many
• Turns out it’s very easy to use with Javascript remoting!
![Page 4: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/4.jpg)
KnockoutJS Architecture
• Knockout uses a Model – View – View Model (MVVM) pattern
• The Model is our Salesforce schema and data• The View displays data from, and triggers actions on the
view model• The View Model is pure code that interacts with the
model, and provides data and actions for the View
![Page 5: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/5.jpg)
View Model and Bindings
• The View Model has properties called observables:self.name = ko.observable(‘Bob’);• The View can bind to these:<span data-bind=“text: name”/>• When the observable value changes, the view changes!
![Page 6: Intro to Knockout.JS for Salesforce1](https://reader034.fdocuments.in/reader034/viewer/2022050919/547ca843b47959ca508b46fe/html5/thumbnails/6.jpg)
Learn More!
• You’re probably hooked by now, so check out these resources to learn more about KnockoutJS:–Interactive tutorials at http://learn.knockoutjs.com/–RTFM! It’s simply written, comprehensive, and logical
(something all to rare these days) http://knockoutjs.com/documentation/introduction.html