Ticket #3202: SelectBox.js.patch
File SelectBox.js.patch, 1.3 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/media/js/SelectBox.js
11 11 }, 12 12 redisplay: function(id) { 13 13 // Repopulate HTML select box from cache 14 // Remove the box from the DOM, manipulate it, then insert again 15 // (offline DOM manipulation = better performance) 14 16 var box = document.getElementById(id); 17 var parent = box.parentNode; 18 var nextSibling = box.nextSibling; // remember where the node was 19 parent.removeChild(box); 15 20 box.options.length = 0; // clear all options 16 for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) { 17 var node = SelectBox.cache[id][i]; 21 var cache = SelectBox.cache[id]; 22 for (var i = 0, j = cache.length; i < j; i++) { 23 var node = cache[i]; 18 24 if (node.displayed) { 19 25 box.options[box.options.length] = new Option(node.text, node.value, false, false); 20 26 } 21 27 } 28 parent.insertBefore(box,nextSibling); // insert back in place 22 29 }, 23 30 filter: function(id, text) { 24 31 // Redisplay the HTML select box, displaying only the choices containing ALL