mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
Fixed another undo bug.
This commit is contained in:
parent
c20f68fcbd
commit
fa1a50eb71
@ -399,24 +399,6 @@ var OfflineStore = function(/* Map */ map) {
|
||||
* @private
|
||||
*/
|
||||
this._reestablishedInternet = function(){
|
||||
// var graphicsArr = this.getStore();
|
||||
// if(graphicsArr != null && this.layers != null){
|
||||
// var length = graphicsArr.length;
|
||||
// for(var i = 0; i < length; i++){
|
||||
// var graphic = graphicsArr[i];
|
||||
// var layer = this.getGraphicsLayerById(graphic.layer);
|
||||
// this._layerEditManager(graphic.graphic,layer,graphic.enumValue,this.enum(),i,function(/* Number */ num, /* boolean */ success, /* String */ id,error){
|
||||
// var date = new Date();
|
||||
// var indexObject = new this._indexObject(graphic.layer,id,graphic.enumValue,success,graphic.graphic.geometry.type,date) ;
|
||||
// var serializeGraphic = this._serializeGraphic(graphic.graphic,graphic.layer,graphic.enumValue);
|
||||
// var deleteTempItem = this._deleteItemInLocalStore(serializeGraphic);
|
||||
// this._setItemLocalStoreIndexObject(indexObject);
|
||||
// }.bind(this));
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// console.log("_reestablishedInternet: graphicsArray was null.");
|
||||
// }
|
||||
|
||||
var data = localStorage.getItem(this._localEnum().STORAGE_KEY);
|
||||
if(data != null){
|
||||
@ -426,10 +408,11 @@ var OfflineStore = function(/* Map */ map) {
|
||||
if(typeof item !== "undefined" && item.length > 0 && item !== null && item != ""){
|
||||
var graphic = this._deserializeGraphic(item);
|
||||
var layer = this.getGraphicsLayerById(graphic.layer);
|
||||
var valueToDelete = item;
|
||||
this._layerEditManager(graphic.graphic,layer,graphic.enumValue,this.enum(),function(/* Number */ num, /* boolean */ success, /* String */ id,error){
|
||||
var date = new Date();
|
||||
var indexObject = new this._indexObject(graphic.layer,id,graphic.enumValue,success,graphic.graphic.geometry.type,date) ;
|
||||
var deleteTempItem = this._deleteItemInLocalStore(item);
|
||||
var deleteTempItem = this._deleteItemTempLocalStore(valueToDelete);
|
||||
this._setItemLocalStoreIndexObject(indexObject);
|
||||
}.bind(this));
|
||||
}
|
||||
@ -534,7 +517,7 @@ var OfflineStore = function(/* Map */ map) {
|
||||
* @param callback
|
||||
* @private
|
||||
*/
|
||||
this._deleteObjectIdInLocalStore = function(/* String */ objectId,callback){
|
||||
this._deleteObjectIdTempLocalStore = function(/* String */ objectId,callback){
|
||||
var success = false;
|
||||
var localStore = localStorage.getItem(this._localEnum().STORAGE_KEY);
|
||||
if(localStore != null){
|
||||
@ -564,7 +547,7 @@ var OfflineStore = function(/* Map */ map) {
|
||||
* @param callback
|
||||
* @private
|
||||
*/
|
||||
this._deleteItemInLocalStore = function(/* String */ entry,callback){
|
||||
this._deleteItemTempLocalStore = function(/* String */ entry,callback){
|
||||
var success = false;
|
||||
var localStore = localStorage.getItem(this._localEnum().STORAGE_KEY);
|
||||
if(localStore != null){
|
||||
|
||||
@ -363,7 +363,7 @@ Sample demonstrates basic offline editing functionality for points, lines and po
|
||||
editToolbar.deactivate();
|
||||
var newAttributes = lang.mixin({}, selectedTemplate.template.prototype.attributes);
|
||||
var newGraphic = new Graphic(evt.geometry, null, newAttributes);
|
||||
//selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);
|
||||
|
||||
offlineStore.applyEdits(newGraphic,selectedTemplate.featureLayer,offlineStore.enum().ADD,function(count,result,id){
|
||||
if(result.success == true){
|
||||
updatePendingTextArea()
|
||||
|
||||
@ -225,7 +225,7 @@ describe("Validate local storage functionality - delete single Point",function()
|
||||
|
||||
it("delete one graphic from local storage", function(){
|
||||
var value = null;
|
||||
var attempt = offlineStore._deleteObjectIdInLocalStore("42749",function(evt){
|
||||
var attempt = offlineStore._deleteObjectIdTempLocalStore("42749",function(evt){
|
||||
value = evt;
|
||||
}.bind(this))
|
||||
expect(value).toEqual(true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user