Commits

Andrew Smith committed 5e35793

Correct major logic issues when selecting multiple rows.

The rows were being incorrectly selected (because the class name had a
missing '.').

jQuery items can't be directly compared to each other so we need to get
the HTML element to test if they are the same.

Comments (0)

Files changed (1)

public/javascripts/context_menu.jquery.js

                             if (lastSelected !== null)
                             {
                                 var toggling = false;
-                                var rows = $(selectorName);
-                                for (i = 0; i < rows.length; i++)
-                                {
-                                    if (toggling || rows[i] == tr)
-                                    {
-                                        methods.addSelection(rows[i]);
+                                var rows = $('.' + selectorName);
+                                rows.each(function() {
+                                    var self = $(this);
+                                    if(toggling || (self.get(0) == tr.get(0))) {
+                                        methods.addSelection(self);
                                     }
-                                    if (rows[i] == tr || rows[i] == lastSelected)
-                                    {
+                                    if(((self.get(0) == tr.get(0)) || (self.get(0) == lastSelected.get(0)))
+                                        && (tr.get(0) !== lastSelected.get(0))) {
                                         toggling = !toggling;
                                     }
-                                }
+                                });
                             } else {
                                 methods.addSelection(tr);
                             }