Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Knockout in our app


Let's make another copy of our jQuery app and name the folder Knockout. We will not need jQuery for this application, since we can use Knockout and the ArcGIS JavaScript API to handle those functions. We'll start by replacing all the references to jQuery with Knockout references. The dojoConfig script at the head of the document should look like the following:

dojoConfig = {
  async: true,
  packages: [
    {
      name: 'y2k',
      location: location.pathname.replace(/\/[^\/]*$/, '') + '/js'
   }, {
      name: "d3",
      location: "http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.12/"
    }, {
     name: "knockout",
     location: "http://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0",
     main: "knockout-min"
   }
  ]
};

Next, we'll add a reference to Knockout in our Census.js file. We'll keep the other AMD modules and code, and we'll replace things as we go. The define() statement at the top of Census.js should look a bit like the following:

define([…, "d3/d3",...