Skip to content

Instantly share code, notes, and snippets.

@odoe

odoe/CameraStore.js

Created Feb 8, 2016
Embed
What would you like to do?
Sample Collection as a Store
define([
'esri/core/Collection',
'esri/request',
'dojo/Deferred'
], function(
Collection, esriRequest, Deferred
) {
var CameraStore = Collection.createSubclass({
apikey: null,
apiurl: null,
idProperty: 'CameraID',
loadStore: function() {
var dfd = new Deferred();
var self = this;
esriRequest({
url: this.apiurl + this.apikey,
handleAs: 'json'
}).then(function(response) {
response.map(function(x) {
x.visible = true;
self.addItem(x);
});
dfd.resolve(self);
});
return dfd.promise;
}
});
return CameraStore;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment