← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7263: bugfix for dhisAjaxSelect (problem with groupfiltering)

 

------------------------------------------------------------
revno: 7263
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-06-10 19:27:17 +0300
message:
  bugfix for dhisAjaxSelect (problem with groupfiltering)
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	2012-03-26 15:26:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisAjaxSelect.js	2012-06-10 16:27:17 +0000
@@ -52,7 +52,7 @@
  */
 function dhisAjaxSelect_filter_on_kv($target, key, value)
 {
-    $ghost_target = dhis2.select.getGhost($target);
+    var $ghost_target = dhis2.select.getGhost($target);
 
     if (key.length === 0) {
         dhis2.select.moveSorted($target, $ghost_target.children());
@@ -97,15 +97,16 @@
 function compare_data_with_kv($target, key, value)
 {
     var target_value = $target.data(key);
+    target_value = target_value ? target_value : [];
 
-    if(! $.isArray(target_value) ) {
+    if( !$.isArray(target_value) ) {
         var type = typeof(target_value);
 
         if(type === "number") {
             target_value = [ target_value.toString() ];
         } else {
             target_value = target_value.split(",");
-        };
+        }
     }
 
     if (target_value) {
@@ -325,13 +326,13 @@
             $select.data("settings", settings);
             methods.load("" + id);
 
-            $filter_button.bind('click', function(e)
+            $filter_button.bind('click', function()
             {
-                key = $filter_input.val();
+                var key = $filter_input.val();
                 dhis2.select.filterWithKey($select, key);
             });
 
-            $clear_button.bind('click', function(e) {
+            $clear_button.bind('click', function() {
                 $filter_input.val('');
                 dhis2.select.filterWithKey($select, ''); 
             });
@@ -362,4 +363,4 @@
             $.error('Method ' + method + ' does not exist on jQuery.dhisAjaxSelect');
         }
     };
-})(jQuery, undefined);
+})(jQuery);