dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21823
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10429: only load program associations after ouwt is loaded
------------------------------------------------------------
revno: 10429
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-27 19:21:59 +0700
message:
only load program associations after ouwt is loaded
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.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-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-03-27 10:32:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-03-27 12:21:59 +0000
@@ -8,28 +8,31 @@
setHeaderMessage( "Loading.. please wait" );
- // initialize the stores, and then try and add the data
- DAO.programs = new dhis2.storage.Store( {name: 'programs'}, function ( store ) {
- DAO.programAssociations = new dhis2.storage.Store( {name: 'programAssociations'}, function ( store ) {
- jQuery.getJSON( "getProgramMetaData.action", {}, function ( data ) {
- var keys = _.keys( data.metaData.programs );
- var objs = _.values( data.metaData.programs );
-
- DAO.programs.addAll( keys, objs, function ( store ) {
- var keys = _.keys( data.metaData.programAssociations );
- var objs = _.values( data.metaData.programAssociations );
-
- DAO.programAssociations.addAll( keys, objs, function ( store ) {
- selection.setListenerFunction( organisationUnitSelected );
- hideHeaderMessage();
+ $( "#orgUnitTree" ).one("ouwtLoaded", function() {
+ // initialize the stores, and then try and add the data
+ DAO.programs = new dhis2.storage.Store( {name: 'programs'}, function ( store ) {
+ DAO.programAssociations = new dhis2.storage.Store( {name: 'programAssociations'}, function ( store ) {
+ jQuery.getJSON( "getProgramMetaData.action", {},function ( data ) {
+ var keys = _.keys( data.metaData.programs );
+ var objs = _.values( data.metaData.programs );
+
+ DAO.programs.addAll( keys, objs, function ( store ) {
+ var keys = _.keys( data.metaData.programAssociations );
+ var objs = _.values( data.metaData.programAssociations );
+
+ DAO.programAssociations.addAll( keys, objs, function ( store ) {
+ selection.setListenerFunction( organisationUnitSelected );
+ hideHeaderMessage();
+ } );
} );
+ } ).fail( function () {
+ selection.setListenerFunction( organisationUnitSelected );
+ hideHeaderMessage();
} );
- } ).fail(function() {
- selection.setListenerFunction( organisationUnitSelected );
- hideHeaderMessage();
- });
- });
- } );
+ } );
+ } );
+ });
+
} );
function organisationUnitSelected( orgUnits, orgUnitNames )