dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35208
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18075: Data set report, sorting of dimension items
------------------------------------------------------------
revno: 18075
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-01-20 20:24:35 +0100
message:
Data set report, sorting of dimension items
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 2014-12-04 08:42:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js 2015-01-20 19:24:35 +0000
@@ -170,8 +170,7 @@
* registered inside a form it will be loaded every time the form is loaded,
* hence the need to unregister and the register the function.
*/
-dhis2.util.on = function( event, fn )
-{
+dhis2.util.on = function( event, fn ) {
$( document ).off( event ).on( event, fn );
};
@@ -180,12 +179,18 @@
* in milliseconds is the value, intended to force fresh non-cached responses
* from server.
*/
-dhis2.util.cacheBust = function()
-{
+dhis2.util.cacheBust = function() {
return "_=" + new Date().getTime();
}
/**
+ * Sorts the two given objects on the name property.
+ */
+dhis2.util.nameSort = function( a, b ) {
+ return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;
+}
+
+/**
* 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-08-06 04:06:04 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2015-01-20 19:24:35 +0000
@@ -103,7 +103,9 @@
html += '<div><label>' + dim.name + '</label></div>';
html += '<select class="dimension" data-uid="' + dim.id + '" style="width:330px">';
html += '<option value="-1">[ ' + i18n_select_option_view_all + ' ]</option>';
-
+
+ dim.items.sort( dhis2.util.nameSort );
+
$.each( dim.items, function( idx, option ) {
html += '<option value="' + option.id + '">' + option.name + '</option>';
} );