dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22387
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10743: Add sort and filter by name or code in Add/Update Aggregate Query Builder.
------------------------------------------------------------
revno: 10743
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-02 21:59:56 +0700
message:
Add sort and filter by name or code in Add/Update Aggregate Query Builder.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm
--
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/caseAggregationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-05-02 14:41:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-05-02 14:59:56 +0000
@@ -8,7 +8,14 @@
<div id="tab-1">
<table>
<tr>
- <td><label for="dataelement">$i18n.getString( "dataelement" )</label></td>
+ <td>
+ <label for="dataelement">$i18n.getString( "dataelement" )</label>
+ <span align='right' style="background:#ADD8E6;padding-left:45px; padding-top:3px; padding-bottom:3px">
+ $i18n.getString( "sort_by" )
+ <input type='radio' name='sortBy' value='1' onchange="sortByOnChange('1')" checked >$i18n.getString("name")
+ <input type='radio' name='sortBy' value='2' onchange="sortByOnChange('2')">$i18n.getString("code")
+ </span>
+ </td>
<td>
<label for="availableValues">$i18n.getString( "available_values" )</label>
<input type='button' title="$i18n.getString( 'insert_selected_values' )" value="»" class="small-button" onClick="insertMultiValues('suggestedDEValues');" >
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-05-02 14:41:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-05-02 14:59:56 +0000
@@ -235,8 +235,8 @@
var deSumId = jQuery('#deSumId');
for ( i in json.dataElements )
{
- dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
- dataElementBackups.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+ dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+ dataElementBackups.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
if( json.dataElements[i].type=='int')
{
deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
@@ -461,3 +461,42 @@
}
+
+function sortByOnChange(sortBy)
+{
+ if( sortBy == 1)
+ {
+ jQuery('#dataElements').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
+ {
+ jQuery('#dataElements').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);
+
+ });
+ }
+}
+
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm 2013-02-07 08:12:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm 2013-05-02 14:59:56 +0000
@@ -4,6 +4,7 @@
{
"id": "${dataElement.id}",
"name": "$!encoder.jsonEncode( ${dataElement.name} )",
+ "code": "$!encoder.jsonEncode( ${dataElement.code} )",
"type": "${dataElement.type}",
"optionset":
#if( $!dataElement.optionSet )