SlideShare une entreprise Scribd logo
1  sur  28
Using MVVM on
the web with Ignite
UI & Knockoutjs



                                        NISHANTH ANIL
                             TECHNICAL EVANGELIST
                      nanil@infragistics.com | nnish.com
                          facebook.com/InfragisticsIndia

                                                 @nishanil
Agenda
– Patterns
– What’s MVVM?
– What’s Knockoutjs?
  • Simple MVVM Demo
– What’s Ignite UI?
  • Building Enterprise Dashboard in HTML5/jQuery
    demo
– Comparing Javascript MV* frameworks


                                                @nishanil
Patterns – are guidelines not
              rules!
• UI patterns
  –   Model – View – Controller
  –   Model – View – Presenter
  –   Presentation Model
  –   Model – View – ViewModel


• Why do they exist?
  – Separation of concerns
  – Testability
  – Maintainability


                                  @nishanil
MVVM?

 View    ViewModel      Model
(HTML)               (jsonxml)




                                  @nishanil
MVVM recap – WPF
   –   INotifyPropertyChanged/INotifyCollectionChanged
   –   DataContext
   –   DataBinding
   –   Commanding

Read more:
http://nnish.in/myIGblog




                                                         @nishanil
MVVM on the web?




                   @nishanil
@nishanil
What’s knockoutjs?
– a compact javascript library
– implements the MVVM pattern for Javascript
– rich client-side interactivity
– supports all major browsers



     6+           2+

     http://knockoutjs.com/documentation/browser-support.html



                                                                @nishanil
Key Concepts




               @nishanil
Knockout in 3 steps
– Declarative Binding


– Dependency Tracking using Observable



– Activating knockout




                                         @nishanil
Observables
– Updates UI automatically when the
  ViewModel changes (UI notification)
– Very famous 2 way binding!
– Declare your properties as ko.observable()
– ko.observable() objects are functions, not a
  property!




                                                 @nishanil
Computed Observables
– Computes value based on one more
  dependent observable (for e.g, compute full
  name based on first name & last name)




                                            @nishanil
Declarative Binding
 – It’s all about data-bind attribute in HTML
 – Not native to HTML, but perfectly OK!
 – The binding value can be a single value, variable, or
   literal or almost any valid JavaScript expression.




         Built-in Bindings                     valueUpdate options
value, visible, text,                    change, keyup, keypre
uniqueName, click                        ss, afterkeydown
etc…
Not happy with built-in bindings? – roll your own! (custom bindings)
                                                                       @nishanil
Observable Array
– Tracks which objects are in the array, not the
  state of those objects
– Notifies changes for add & remove
– No notification for item changes! (use
 ko.observable())
Pre-populating ObservableArray




          Binding it



                                              @nishanil
Built-in Bindings
                        Text & Appearance

 visible      text        attr       style         css        html




                      Working with Form Fields


click       disable    submit       value        hasfocu     enable
                                                    s

event      checked      options    selectedOptions         uniqueName



            Or roll your own! Support s custom binding


                                                                      @nishanil
Binding – Control Flow
foreach
                     Foreach example
  if

 ifnot

 with




                                @nishanil
Knockout & jQuery
• Not a jQuery competitor, Knockout solves
  a different problem!
• Will work together!




                                         @nishanil
Knockoutjs Demo




                  @nishanil
Enterprise dashboards using
      HTML5/jQuery?



                         @nishanil
@nishanil
The World’s Most Advanced
  JavaScript & HTML5 UI
       Framework


                        @nishanil
@nishanil
and a lot more… www.igniteui.com
                                   @nishanil
Ignite UI Demo




                 @nishanil
Javascript MV* F/W           Web
                                       Composed                  Plays Nicely
        Framework        UI Bindings              Presentation
                                       Views                     With Others
                                                  Layer
        Backbone.js      ✗             ✗          ✓              ✓
        SproutCore 1.x   ✓             ✓          ✗              ✗
        Sammy.js         ✗             ✗          ✓              ✓
        Spine.js         ✗             ✗          ✓              ✓
        Cappuccino       ✓             ✓          ✗              ✗
        Knockout.js      ✓             ✗          ✓              ✓
        Javascript
                         ✗             ✓          ✓              ✓
        MVC
        Google Web
                         ✗             ✓          ✗              ✗
        Toolkit
        Google
                         ✗             ✓          ✓              ✗
        Closure
        Ember.js         ✓             ✓          ✓              ✓
        Angular.js       ✓             ✗          ✓              ✓
        Batman.js        ✓             ✗          ✓              ✓
Source: http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/
                                                                                @nishanil
Resources
– Ignite UI
   • www.igniteui.com
– Infragistics Community
   • http://www.infragistics.com/community/
– KnockoutJS –
   • learn.knockoutjs.com
   • http://www.knockmeout.net/
– If you are new to Javascript
   •   https://developer.mozilla.org/en-US/docs/JavaScript/Guide
– Javascript MVC Frameworks reviewed
   • http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-
     reviewed/


                                                                   @nishanil
Slides & Samples
• You can download these slides from
  – http://www.slideshare.net/nishanthanil/
• Samples
  – Knockout
    • https://github.com/nishanil/koSamples
  – Ignite UI Grid & Knockoutjs
    • http://www.infragistics.com/products/jquery/sample
      /grid/grid-knockoutjs-integration



                                                     @nishanil
Q&A

@nishanil on twitter
facebook.com/InfragisticsIndia



                                                   NISHANTH ANIL
                                        TECHNICAL EVANGELIST
                                 nanil@infragistics.com | nnish.com

                                                            @nishanil

Contenu connexe

Similaire à Using mvvm on the web using knockoutjs & ignite ui

Building databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with KnockoutjsBuilding databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with KnockoutjsNish Anil
 
Infragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & SilverlightInfragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & SilverlightNish Anil
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayWesley Hales
 
A Smooth Transition to HTML5
A Smooth Transition to HTML5A Smooth Transition to HTML5
A Smooth Transition to HTML5Chris Bannon
 
Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Gill Cleeren
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlightsdswork
 
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsFabio Franzini
 
JS FAST Prototyping with AngularJS & RequireJS
JS FAST Prototyping with AngularJS & RequireJSJS FAST Prototyping with AngularJS & RequireJS
JS FAST Prototyping with AngularJS & RequireJSYuriy Silvestrov
 
Active Web Development
Active Web DevelopmentActive Web Development
Active Web DevelopmentDivya Manian
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Peter Lubbers
 
Building assets on the fly with Node.js
Building assets on the fly with Node.jsBuilding assets on the fly with Node.js
Building assets on the fly with Node.jsAcquisio
 
Structure mapping your way to better software
Structure mapping your way to better softwareStructure mapping your way to better software
Structure mapping your way to better softwarematthoneycutt
 
Angular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaAngular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaphp2ranjan
 
A Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMA Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMChris Bannon
 
Seattle bestpractices2010
Seattle bestpractices2010Seattle bestpractices2010
Seattle bestpractices2010Olaseni Odebiyi
 
Evaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devicesEvaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devicesMario Gonzalez
 
Kicking Up the Dust with Node JS
Kicking Up the Dust with Node JSKicking Up the Dust with Node JS
Kicking Up the Dust with Node JSBill Scott
 

Similaire à Using mvvm on the web using knockoutjs & ignite ui (20)

Building databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with KnockoutjsBuilding databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with Knockoutjs
 
Infragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & SilverlightInfragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & Silverlight
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
A Smooth Transition to HTML5
A Smooth Transition to HTML5A Smooth Transition to HTML5
A Smooth Transition to HTML5
 
Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Advanced MVVM in Windows 8
Advanced MVVM in Windows 8
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
 
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjsCodemotion 2013 - Designing complex applications using html5 and knockoutjs
Codemotion 2013 - Designing complex applications using html5 and knockoutjs
 
JS FAST Prototyping with AngularJS & RequireJS
JS FAST Prototyping with AngularJS & RequireJSJS FAST Prototyping with AngularJS & RequireJS
JS FAST Prototyping with AngularJS & RequireJS
 
Active Web Development
Active Web DevelopmentActive Web Development
Active Web Development
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)
 
Building assets on the fly with Node.js
Building assets on the fly with Node.jsBuilding assets on the fly with Node.js
Building assets on the fly with Node.js
 
Structure mapping your way to better software
Structure mapping your way to better softwareStructure mapping your way to better software
Structure mapping your way to better software
 
Angular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaAngular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad india
 
Angular js gtg-27feb2013
Angular js gtg-27feb2013Angular js gtg-27feb2013
Angular js gtg-27feb2013
 
A Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMA Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVM
 
Seattle bestpractices2010
Seattle bestpractices2010Seattle bestpractices2010
Seattle bestpractices2010
 
Evaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devicesEvaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devices
 
Kicking Up the Dust with Node JS
Kicking Up the Dust with Node JSKicking Up the Dust with Node JS
Kicking Up the Dust with Node JS
 

Plus de Nish Anil

[MobConf] Go mobile with C#, Visual Studio & Xamarin
[MobConf] Go mobile with C#, Visual Studio & Xamarin[MobConf] Go mobile with C#, Visual Studio & Xamarin
[MobConf] Go mobile with C#, Visual Studio & XamarinNish Anil
 
[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#Nish Anil
 
APAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.FormsAPAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.FormsNish Anil
 
[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile apps[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile appsNish Anil
 
Evolve recap XHackers, Bangalore
Evolve recap XHackers, BangaloreEvolve recap XHackers, Bangalore
Evolve recap XHackers, BangaloreNish Anil
 
iOS & Android Dev in C# & Visual Studio using Xamarin
iOS & Android Dev in C# & Visual Studio using XamariniOS & Android Dev in C# & Visual Studio using Xamarin
iOS & Android Dev in C# & Visual Studio using XamarinNish Anil
 
Building mvvm & single pageapps in js
Building mvvm & single pageapps in jsBuilding mvvm & single pageapps in js
Building mvvm & single pageapps in jsNish Anil
 

Plus de Nish Anil (7)

[MobConf] Go mobile with C#, Visual Studio & Xamarin
[MobConf] Go mobile with C#, Visual Studio & Xamarin[MobConf] Go mobile with C#, Visual Studio & Xamarin
[MobConf] Go mobile with C#, Visual Studio & Xamarin
 
[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#
 
APAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.FormsAPAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.Forms
 
[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile apps[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile apps
 
Evolve recap XHackers, Bangalore
Evolve recap XHackers, BangaloreEvolve recap XHackers, Bangalore
Evolve recap XHackers, Bangalore
 
iOS & Android Dev in C# & Visual Studio using Xamarin
iOS & Android Dev in C# & Visual Studio using XamariniOS & Android Dev in C# & Visual Studio using Xamarin
iOS & Android Dev in C# & Visual Studio using Xamarin
 
Building mvvm & single pageapps in js
Building mvvm & single pageapps in jsBuilding mvvm & single pageapps in js
Building mvvm & single pageapps in js
 

Dernier

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Using mvvm on the web using knockoutjs & ignite ui

  • 1. Using MVVM on the web with Ignite UI & Knockoutjs NISHANTH ANIL TECHNICAL EVANGELIST nanil@infragistics.com | nnish.com facebook.com/InfragisticsIndia @nishanil
  • 2. Agenda – Patterns – What’s MVVM? – What’s Knockoutjs? • Simple MVVM Demo – What’s Ignite UI? • Building Enterprise Dashboard in HTML5/jQuery demo – Comparing Javascript MV* frameworks @nishanil
  • 3. Patterns – are guidelines not rules! • UI patterns – Model – View – Controller – Model – View – Presenter – Presentation Model – Model – View – ViewModel • Why do they exist? – Separation of concerns – Testability – Maintainability @nishanil
  • 4. MVVM? View ViewModel Model (HTML) (jsonxml) @nishanil
  • 5. MVVM recap – WPF – INotifyPropertyChanged/INotifyCollectionChanged – DataContext – DataBinding – Commanding Read more: http://nnish.in/myIGblog @nishanil
  • 6. MVVM on the web? @nishanil
  • 8. What’s knockoutjs? – a compact javascript library – implements the MVVM pattern for Javascript – rich client-side interactivity – supports all major browsers 6+ 2+ http://knockoutjs.com/documentation/browser-support.html @nishanil
  • 9. Key Concepts @nishanil
  • 10. Knockout in 3 steps – Declarative Binding – Dependency Tracking using Observable – Activating knockout @nishanil
  • 11. Observables – Updates UI automatically when the ViewModel changes (UI notification) – Very famous 2 way binding! – Declare your properties as ko.observable() – ko.observable() objects are functions, not a property! @nishanil
  • 12. Computed Observables – Computes value based on one more dependent observable (for e.g, compute full name based on first name & last name) @nishanil
  • 13. Declarative Binding – It’s all about data-bind attribute in HTML – Not native to HTML, but perfectly OK! – The binding value can be a single value, variable, or literal or almost any valid JavaScript expression. Built-in Bindings valueUpdate options value, visible, text, change, keyup, keypre uniqueName, click ss, afterkeydown etc… Not happy with built-in bindings? – roll your own! (custom bindings) @nishanil
  • 14. Observable Array – Tracks which objects are in the array, not the state of those objects – Notifies changes for add & remove – No notification for item changes! (use ko.observable()) Pre-populating ObservableArray Binding it @nishanil
  • 15. Built-in Bindings Text & Appearance visible text attr style css html Working with Form Fields click disable submit value hasfocu enable s event checked options selectedOptions uniqueName Or roll your own! Support s custom binding @nishanil
  • 16. Binding – Control Flow foreach Foreach example if ifnot with @nishanil
  • 17. Knockout & jQuery • Not a jQuery competitor, Knockout solves a different problem! • Will work together! @nishanil
  • 18. Knockoutjs Demo @nishanil
  • 19. Enterprise dashboards using HTML5/jQuery? @nishanil
  • 21. The World’s Most Advanced JavaScript & HTML5 UI Framework @nishanil
  • 23. and a lot more… www.igniteui.com @nishanil
  • 24. Ignite UI Demo @nishanil
  • 25. Javascript MV* F/W Web Composed Plays Nicely Framework UI Bindings Presentation Views With Others Layer Backbone.js ✗ ✗ ✓ ✓ SproutCore 1.x ✓ ✓ ✗ ✗ Sammy.js ✗ ✗ ✓ ✓ Spine.js ✗ ✗ ✓ ✓ Cappuccino ✓ ✓ ✗ ✗ Knockout.js ✓ ✗ ✓ ✓ Javascript ✗ ✓ ✓ ✓ MVC Google Web ✗ ✓ ✗ ✗ Toolkit Google ✗ ✓ ✓ ✗ Closure Ember.js ✓ ✓ ✓ ✓ Angular.js ✓ ✗ ✓ ✓ Batman.js ✓ ✗ ✓ ✓ Source: http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/ @nishanil
  • 26. Resources – Ignite UI • www.igniteui.com – Infragistics Community • http://www.infragistics.com/community/ – KnockoutJS – • learn.knockoutjs.com • http://www.knockmeout.net/ – If you are new to Javascript • https://developer.mozilla.org/en-US/docs/JavaScript/Guide – Javascript MVC Frameworks reviewed • http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks- reviewed/ @nishanil
  • 27. Slides & Samples • You can download these slides from – http://www.slideshare.net/nishanthanil/ • Samples – Knockout • https://github.com/nishanil/koSamples – Ignite UI Grid & Knockoutjs • http://www.infragistics.com/products/jquery/sample /grid/grid-knockoutjs-integration @nishanil
  • 28. Q&A @nishanil on twitter facebook.com/InfragisticsIndia NISHANTH ANIL TECHNICAL EVANGELIST nanil@infragistics.com | nnish.com @nishanil