From 413e9a39bcdd7a3ed74e42cefd4e2a1d9a7e3aba Mon Sep 17 00:00:00 2001 From: Andy Gup Date: Thu, 26 Mar 2015 18:41:52 -0600 Subject: [PATCH] added error handling --- demo/samples/editing-step3.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/demo/samples/editing-step3.html b/demo/samples/editing-step3.html index 8d9f03f..441c45f 100644 --- a/demo/samples/editing-step3.html +++ b/demo/samples/editing-step3.html @@ -214,9 +214,18 @@ //https://developers.arcgis.com/en/javascript/jshelp/ags_proxy.html offlineFeaturesManager.proxyPath = null; + // IMPORTANT!!! + // This tells the database which graphic.attribute property to use as a unique identifier + // You can lok this information up in your feature service directory under the "Fields" category. + // Example: http://services1.arcgis.com/M8KJPUwAXP8jhtnM/arcgis/rest/services/Denver_Bus_Stops/FeatureServer/0 + offlineFeaturesManager.DB_UID = "FID"; + offlineFeaturesManager.on(offlineFeaturesManager.events.EDITS_ENQUEUED, updatePendingEditStatus); offlineFeaturesManager.on(offlineFeaturesManager.events.EDITS_SENT, updatePendingEditStatus); offlineFeaturesManager.on(offlineFeaturesManager.events.ALL_EDITS_SENT, updatePendingEditStatus); + offlineFeaturesManager.on(offlineFeaturesManager.events.EDITS_ENQUEUED_ERROR, function(errorsArray){ + alert("There was an error attempting to write to the database: " + JSON.stringify(errorsArray)); + }); offlineFeaturesManager.extend(busStopFeatureLayer, function (success, error) { if (success) { @@ -247,13 +256,9 @@ } function updatePendingEditStatus() { - if (editsStore.hasPendingEdits()) { - var edits = editsStore.retrieveEditsQueue(); - pendingEdits.innerHTML = edits.length; - } - else { - pendingEdits.innerHTML = 0; - } + busStopFeatureLayer.pendingEditsCount(function(count){ + pendingEdits.innerHTML = count; + }); }