← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9018: properly reset section filters when changing datasets

 

------------------------------------------------------------
revno: 9018
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-14 11:01:55 +0100
message:
  properly reset section filters when changing datasets
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-10-08 18:25:56 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-11-14 10:01:55 +0000
@@ -519,7 +519,7 @@
 function enableSectionFilter()
 {
     var $sectionsHeaders = $( '.formSection .cent h3' );
-    $( '#filterDataSetSection' ).children().remove();
+    clearSectionFilters();
 
     if ( $sectionsHeaders.size() > 1)
     {
@@ -540,6 +540,21 @@
     }
 }
 
+function resetSectionFilters()
+{
+    $( '#selectionBox' ).css( 'height', '93px' );
+    $( '#filterDataSetSectionTr' ).hide();
+    $( '.formSection' ).show();
+}
+
+function clearSectionFilters()
+{
+    $( '#filterDataSetSection' ).children().remove();
+    $( '#selectionBox' ).css( 'height', '93px' );
+    $( '#filterDataSetSectionTr' ).hide();
+    $( '.formSection' ).show();
+}
+
 function filterOnSection()
 {
     var $filterDataSetSection = $( '#filterDataSetSection' );
@@ -694,7 +709,7 @@
 
     var dataSetValid = false;
 
-    for ( i in dataSetList )
+    for ( var i in dataSetList )
     {
         addOptionById( 'selectedDataSetId', dataSetList[i].id, dataSetList[i].name );
 
@@ -710,12 +725,14 @@
 
         if ( periodId && periodId != -1 && dataEntryFormIsLoaded )
         {
+            resetSectionFilters();
             showLoader();
             loadDataValues();
         }
     }
     else
     {
+        clearSectionFilters();
         clearPeriod();
     }
 }
@@ -787,6 +804,7 @@
     if ( dataSetId && dataSetId != -1 )
     {
         clearListById( 'selectedPeriodId' );
+        clearSectionFilters();
 
         addOptionById( 'selectedPeriodId', '-1', '[ ' + i18n_select_period + ' ]' );