← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3796: fixed group filtering bug

 

------------------------------------------------------------
revno: 3796
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-30 21:49:37 +0200
message:
  fixed group filtering bug
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisAjaxSelect.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisAjaxSelect.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisAjaxSelect.js	2011-05-30 19:06:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisAjaxSelect.js	2011-05-30 19:49:37 +0000
@@ -77,7 +77,13 @@
         while (current !== undefined) {
             var $current = $(current);
 
-            if ($children.eq(array_idx).html() > $current.html()) {
+            var child_html = $children.eq(array_idx).html();
+            var current_html = $current.html();
+            
+            child_html = (child_html !== null) ? child_html.toLowerCase() : child_html;
+            current_html = (current_html !== null) ? current_html.toLowerCase() : current_html;
+
+            if (child_html > current_html) {
                 $(current).insertBefore($children.eq(array_idx));
                 current = array.shift();
             } else {
@@ -275,14 +281,6 @@
                         });
                     }
                 }
-
-                // TODO temporary hack...
-                function comp(a, b) {
-                    return (a.innerHTML > b.innerHTML) ? 1 : -1;
-                }
-
-                $select.html( $select.children().sort(comp) );
-                // end
             });
         },
         init : function(options)