← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4301: made dataValue upload work correctly

 

------------------------------------------------------------
revno: 4301
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-08-15 15:48:42 +0200
message:
  made dataValue upload work correctly
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-08-15 12:44:50 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-08-15 13:48:42 +0000
@@ -215,15 +215,15 @@
 
     for(var dataValueKey in dataValues) {
         var dataValue = dataValues[dataValueKey];
-        console.log(dataValue);
 
         $.ajax( {
             url : "saveValue.action",
             data : dataValue,
             dataType : 'json',
-            success : function( json ) {
-                storageManager.clearDataValueJSON( dataValue );
-                console.log("Successfully saved dataValue with value " + dataValue.value);
+            dataValue: dataValue,
+            success : function( data, textStatus, jqXHR ) {
+                storageManager.clearDataValueJSON( this.dataValue );
+                console.log("Successfully saved dataValue with value " + this.dataValue );
             }
         } );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-15 12:44:50 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-15 13:48:42 +0000
@@ -1079,9 +1079,14 @@
 	    var id = this.getDataValueIdentifier( dataElementId, categoryOptionComboId, periodId, organisationUnitId );
 	    var dataValues = this.getAllDataValues();
 
-	    console.log("deleting with id " + id);
+	    var ret = delete dataValues[id];
 	    
-	    delete dataValues[id];
+	    if(ret) {
+	        console.log("deleted with id " + id);
+	    } else {
+	        console.log("could not delete with id " + id);
+	    }
+
 	    localStorage[KEY_DATAVALUES] = JSON.stringify( dataValues );
 	}