← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14761: Minor

 

------------------------------------------------------------
revno: 14761
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-09 19:42:46 +0200
message:
  Minor
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.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-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-04 03:49:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-09 17:42:46 +0000
@@ -54,13 +54,18 @@
 	var url = "getCategoryOptionGroups.action";
 	
 	$.getJSON( url, {ou:ou}, function( json ) {
-		var html = "";
-		$.each( json.categoryOptionGroups, function( index, group ) {
-			html += "<option value=\"" + group.uid + "\" data-dimension=\"" + group.groupSet + "\">" + group.name + "</option>";
-		} );
-
-		$( "#categoryOptionGroupSection" ).show();
-		$( "#categoryOptionGroupId" ).html( html );
+		if ( json.categoryOptionGroups && json.categoryOptionGroups.length ) {
+			var html = "";
+			$.each( json.categoryOptionGroups, function( index, group ) {
+				html += "<option value=\"" + group.uid + "\" data-dimension=\"" + group.groupSet + "\">" + group.name + "</option>";
+			} );
+	
+			$( "#categoryOptionGroupSection" ).show();
+			$( "#categoryOptionGroupId" ).html( html );
+		}
+		else {
+			$( "#categoryOptionGroupSection" ).hide();			
+		}
 	} );
 }