Django

Code

Changeset 6015

Show
Ignore:
Timestamp:
08/25/07 18:33:58 (1 year ago)
Author:
adrian
Message:

Fixed #348 -- Fixed bug in admin JavaScript? filter interface. Thanks for the patch, Gary Wilson

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/admin/media/js/SelectBox.js

    r450 r6015  
    77        var cache = SelectBox.cache[id]; 
    88        for (var i = 0; (node = box.options[i]); i++) { 
    9             cache.push({ value: node.value, text: node.text, displayed: 1 }); 
     9            cache.push({value: node.value, text: node.text, displayed: 1}); 
    1010        } 
    1111    }, 
     
    5151    }, 
    5252    add_to_cache: function(id, option) { 
    53         SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 }); 
     53        SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); 
    5454    }, 
    5555    cache_contains: function(id, value) { 
     
    6969        for (var i = 0; (option = from_box.options[i]); i++) { 
    7070            if (option.selected && SelectBox.cache_contains(from, option.value)) { 
    71                 SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 }); 
     71                SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); 
    7272                SelectBox.delete_from_cache(from, option.value); 
    7373            } 
     
    8181        var option; 
    8282        for (var i = 0; (option = from_box.options[i]); i++) { 
    83             SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 }); 
    84             SelectBox.delete_from_cache(from, option.value); 
     83            if (SelectBox.cache_contains(from, option.value)) { 
     84                SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); 
     85                SelectBox.delete_from_cache(from, option.value); 
     86            } 
    8587        } 
    8688        SelectBox.redisplay(from);