dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28988
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14572: Data set report, fixed issue with promise responses
------------------------------------------------------------
revno: 14572
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-31 18:39:30 +0200
message:
Data set report, fixed issue with promise responses
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2013-12-18 09:42:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2014-03-31 16:39:30 +0000
@@ -102,6 +102,27 @@
}
/**
+ * Normalizes an argument object returned from a jQuery promise. If the argument
+ * is undefined, not an array or an empty array, undefined is returned. If the
+ * argument is a single promise object, the object is wrapped in an array. If the
+ * argument is an array of promise objects, the array is returned unmodified.
+ */
+dhis2.util.normalizeArguments = function( args ) {
+ if ( !args || !args.length || !args[0] ) {
+ return undefined;
+ }
+
+ if ( $.isArray( args[0] ) ) {
+ return args;
+ }
+ else {
+ var arr = [];
+ arr[0] = args;
+ return arr;
+ }
+}
+
+/**
* adds ':containsNC' to filtering.
* $(sel).find(':containsNC(key)').doSomething();
*/
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2014-03-30 04:37:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2014-03-31 16:39:30 +0000
@@ -102,8 +102,9 @@
$.when.apply( $, categoryRx ).done( function() {
var html = '';
+ var args = dhis2.util.normalizeArguments( arguments );
- $.each( arguments, function( idx, cat ) {
+ $.each( args, function( idx, cat ) {
var category = cat[0];
html += '<div class="inputSection">';