dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20637
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9545: Modify data element form in design patient entry form.
------------------------------------------------------------
revno: 9545
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-01-17 22:14:06 +0700
message:
Modify data element form in design patient entry form.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/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-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-17 12:54:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-17 15:14:06 +0000
@@ -7,7 +7,7 @@
dataElementSelector = jQuery("#dataElementSelection").dialog({
title: i18n_dataelement,
height: 400,
- width:480,
+ width: jQuery("#dataElementIds").outerWidth() + 30,
autoOpen: false,
zIndex:99999
});
@@ -213,31 +213,44 @@
var item = jQuery(this);
item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename');
});
- }
+ }
+ jQuery("#dataElementIds").width(jQuery("#dataElementSelection").width() - 10 );
}
function sortByOnChange(sortBy)
{
- var sb = $('#dataElementIds');
-
if( sortBy == 1)
{
- sb.append(sb.find('option').sort(function(a, b){
- return (
- a = $(a).attr('dename'),
- b = $(b).attr('dename'),
- a == 'NA' ? 1 : b == 'NA' ? -1 : 0|a > b
- );
- }));
+ $('#dataElementIds').each(function() {
+
+ // Keep track of the selected option.
+ var selectedValue = $(this).val();
+
+ // sort it out
+ $(this).html($("option", $(this)).sort(function(a, b) {
+ return $(a).attr('dename') == $(b).attr('dename') ? 0 : $(a).attr('dename') < $(b).attr('dename') ? -1 : 1
+ }));
+
+ // Select one option.
+ $(this).val(selectedValue);
+
+ });
}
else
{
- sb.append(sb.find('option').sort(function(a, b){
- return (
- a = $(a).attr('decode'),
- b = $(b).attr('decode'),
- a == 'NA' ? 1 : b == 'NA' ? -1 : 0|a > b
- );
- }));
- }
+ $('#dataElementIds').each(function() {
+
+ // Keep track of the selected option.
+ var selectedValue = $(this).val();
+
+ // sort it out
+ $(this).html($("option", $(this)).sort(function(a, b) {
+ return $(a).attr('decode') == $(b).attr('decode') ? 0 : $(a).attr('decode') < $(b).attr('decode') ? -1 : 1
+ }));
+
+ // Select one option.
+ $(this).val(selectedValue);
+
+ });
+ }
}