dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13571
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4379: Saving meta-data in sessionStorage. Overwriting on each page load when online. Means meta-data su...
------------------------------------------------------------
revno: 4379
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-08-19 14:47:28 +0200
message:
Saving meta-data in sessionStorage. Overwriting on each page load when online. Means meta-data survives offline page refresh.
modified:
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/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-19 12:46:19 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-19 12:47:28 +0000
@@ -112,13 +112,20 @@
function loadMetaData()
{
- $.getJSON( 'getMetaData.action', function( json ) {
- significantZeros = json.metaData.significantZeros;
- dataElements = json.metaData.dataElements;
- indicatorFormulas = json.metaData.indicatorFormulas;
- dataSets = json.metaData.dataSets;
- dataSetAssociationSets = json.metaData.dataSetAssociationSets;
- organisationUnitAssociationSetMap = json.metaData.organisationUnitAssociationSetMap;
+ var KEY_METADATA = "metadata";
+
+ $.getJSON( 'getMetaData.action', function( json ) {
+ sessionStorage[KEY_METADATA] = JSON.stringify( json.metaData );
+ } ).complete( function() {
+
+ var metaData = JSON.parse( sessionStorage[KEY_METADATA] );
+
+ significantZeros = metaData.significantZeros;
+ dataElements = metaData.dataElements;
+ indicatorFormulas = metaData.indicatorFormulas;
+ dataSets = metaData.dataSets;
+ dataSetAssociationSets = metaData.dataSetAssociationSets;
+ organisationUnitAssociationSetMap = metaData.organisationUnitAssociationSetMap;
selection.responseReceived(); // Notify that meta data is loaded
$( '#loaderSpan' ).hide();