stubbed get and push featureCollections

This commit is contained in:
Andy Gup 2015-05-26 11:13:56 -06:00
parent ada41c9959
commit 4a1d316637

View File

@ -22,6 +22,7 @@ O.esri.Edit.EditStore = function () {
this.DELETE = "delete";
this.FEATURE_LAYER_JSON_ID = "feature-layer-object-1001";
this.FEATURE_COLLECTION_ID = "feature-collection-object-1001";
this.PHANTOM_GRAPHIC_PREFIX = "phantom-layer";
this._PHANTOM_PREFIX_TOKEN = "|@|";
@ -69,6 +70,42 @@ O.esri.Edit.EditStore = function () {
}
};
this._pushFeatureCollections = function(featureCollectionObject, callback){
var transaction = this._db.transaction([this.objectStoreName], "readwrite");
transaction.oncomplete = function (event) {
callback(true);
};
transaction.onerror = function (event) {
callback(false, event.target.error.message);
};
var objectStore = transaction.objectStore(this.objectStoreName);
objectStore.put(featureCollectionObject);
};
this._getFeatureCollections = function(callback){
var objectStore = this._db.transaction([this.objectStoreName], "readwrite").objectStore(this.objectStoreName);
//Get the entry associated with the graphic
var objectStoreGraphicRequest = objectStore.get(this.FEATURE_COLLECTION_ID);
objectStoreGraphicRequest.onsuccess = function () {
var object = objectStoreGraphicRequest.result;
if (typeof object != "undefined") {
callback(true, object);
}
else {
callback(false, "nothing found");
}
};
objectStoreGraphicRequest.onerror = function (msg) {
callback(false, msg);
};
};
/**
* Use this to store any static FeatureLayer or related JSON data related to your app that will assist in restoring
* a FeatureLayer.