dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22384
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10742: Fix bug: Filter data element not working in Add/Update Aggregate Tabular Report.
------------------------------------------------------------
revno: 10742
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-02 21:41:51 +0700
message:
Fix bug: Filter data element not working in Add/Update Aggregate Tabular Report.
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
--
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 03:31:45 +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:41:51 +0000
@@ -17,7 +17,7 @@
<tr>
<td>
- <input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDE(event, this.value, 'dataElements');" style='width:265px;'/>
+ <input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDataElement(event, this.value, 'dataElements','dataElementBackups');" style='width:265px;'/>
<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchValue', '');" style='width:50px'>
</td>
<td rowspan="4">
@@ -27,6 +27,7 @@
<tr>
<td>
<select id="dataElements" name="dataElements" size="8" ondblclick="insertDataElement(this);" onclick="getSuggestedValues(this.id, 'suggestedDEValues' )"></select>
+ <select id="dataElementBackups" name="dataElementBackups" style='display:none;'></select>
</td>
</tr>
</table>
@@ -138,3 +139,4 @@
var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ) , "'") ';
var i18n_age_days = '$encoder.jsEscape( $i18n.getString( "age_days" ) , "'") ';
</script>
+
=== 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 09:43:44 +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:41:51 +0000
@@ -210,6 +210,7 @@
function getPatientDataElements()
{
clearListById( 'dataElements' );
+ clearListById( 'dataElementBackups' );
clearListById( 'deSumId' );
var programStageId = getFieldValue('programStageId');
@@ -226,11 +227,16 @@
else{
disable('programStageProperty');
}
+
var dataElements = jQuery('#dataElements');
+ var dataElementBackups = jQuery('#dataElementBackups');
+ clearListById( 'dataElements' );
+ clearListById( 'dataElementBackups' );
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>" );
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>" );
@@ -435,3 +441,23 @@
disable('deSumId');
}
}
+
+function filterDataElement( event, value, fieldName, backupFieldsName )
+{
+ // Remove all options in data element fields
+ var field = jQuery('#' + fieldName + " option " ).remove();
+
+ jQuery('#' + backupFieldsName + " option ").each( function(){
+ var option = jQuery(this);
+ if(value.length == 0 )
+ {
+ jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "'>" + option.text() + "</option>" );
+ }
+ else if (option.text().toLowerCase().indexOf( value.toLowerCase() ) != -1 )
+ {
+ jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "'>" + option.text() + "</option>" );
+ }
+ });
+
+}
+