Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions smart_selects/static/smart-selects/admin/js/chainedm2m.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@
}
}

// SelectBox is a global var from djangojs "admin/js/SelectBox.js"
// Clear cache to avoid the elements duplication
if (typeof SelectBox !== 'undefined') {
if (typeof SelectBox.cache[cache_to] !== 'undefined') {
SelectBox.cache[cache_to].splice(0);
}
if (typeof SelectBox.cache[cache_from] !== 'undefined') {
SelectBox.cache[cache_from].splice(0);
}
}

if (!val || val === '') {
$selectField.html('');
$selectedto.html('');
Expand Down Expand Up @@ -111,6 +100,18 @@
});

$selectField.html(options);

// SelectBox is a global var from djangojs "admin/js/SelectBox.js"
// Clear cache to avoid the elements duplication
if (typeof SelectBox !== 'undefined') {
if (typeof SelectBox.cache[cache_to] !== 'undefined') {
SelectBox.cache[cache_to].splice(0);
}
if (typeof SelectBox.cache[cache_from] !== 'undefined') {
SelectBox.cache[cache_from].splice(0);
}
}

if ($selectedto.length) {
$selectedto.html(selectedoptions);
// SelectBox is a global var from djangojs "admin/js/SelectBox.js"
Expand Down