← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8069: minor speedup

 

------------------------------------------------------------
revno: 8069
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-09-13 14:49:41 +0700
message:
  minor speedup
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-13 07:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-09-13 07:49:41 +0000
@@ -455,15 +455,17 @@
 function filterInSection($this)
 {
     var $tbody = $this.parent().parent().parent();
+    var $trTarget = $tbody.find("tr:not([colspan])");
 
     if($this.val() == '')
     {
-        $tbody.find("tr:not([colspan])").show();
+        $trTarget.show();
     }
     else
     {
-        var $matched = $tbody.find('tr:not([colspan])').find('td:first-child(:contains("' + $this.val() + '")')
-        var $not_matched = $tbody.find('tr:not([colspan])').find('td:first-child(:not(:contains("' + $this.val() + '"))')
+        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();