dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12040
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3577: added sorting to filterSelect
------------------------------------------------------------
revno: 3577
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-11 14:12:30 +0200
message:
added sorting to filterSelect
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.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-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-05-11 11:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-05-11 12:12:30 +0000
@@ -46,6 +46,18 @@
$option.appendTo( select_selector );
}
});
+
+ var $sorted = $(select_selector).find("option").sort(function(a, b) {
+ var idxa = +$(a).data("idx");
+ var idxb = +$(b).data("idx");
+
+ if(idxa > idxb) return 1;
+ else if(idxa < idxb) return -1;
+ else return 0;
+ })
+
+ $(select_selector).empty();
+ $sorted.appendTo( select_selector );
}
function showThenFadeOutMessage( message )