← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8093: implemented case-insensitive search for search in section

 

------------------------------------------------------------
revno: 8093
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-15 12:11:59 +0700
message:
  implemented case-insensitive search for search in section
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-09-15 04:31:54 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-09-15 05:11:59 +0000
@@ -464,11 +464,20 @@
     else
     {
         var $trTargetChildren = $trTarget.find( 'td:first-child' );
-        var $matched = $trTargetChildren.find( ':contains("' + $this.val() + '")' );
-        var $not_matched = $trTargetChildren.find( ':not(:contains("' + $this.val() + '"))' );
-
-        $matched.parent().parent(). show();
-        $not_matched.parent().parent(). hide();
+
+        $trTargetChildren.each(function(idx, item) {
+            var text1 = $this.val().toUpperCase();
+            var text2 = $(item).find('span').html().toUpperCase();
+
+            if(text2.indexOf(text1) >= 0)
+            {
+                $(item).parent().show();
+            }
+            else
+            {
+                $(item).parent().hide();
+            }
+        });
     }
 
     refreshZebraStripes($tbody);