Skip to content

Commit

Permalink
Fix - trigger chosen:update when value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
desecho authored and blag committed Nov 2, 2016
1 parent 1e8a7bf commit d78bcf0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions smart_selects/static/smart-selects/admin/js/chainedm2m.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@
},

fill_field: function(val, initial_value, elem_id, url, initial_parent, auto_choose){
function trigger_chosen_updated() {
if ($.fn.chosen !== undefined) {
$(elem_id).trigger('chosen:updated');
}
}

if (!val || val === ''){
$(elem_id).html('');
trigger_chosen_updated();
return;
}

Expand Down Expand Up @@ -63,9 +70,7 @@

$(elem_id).trigger('change');

if ($.fn.chosen !== undefined) {
$(elem_id).trigger('chosen:updated');
}
trigger_chosen_updated();
});
},

Expand Down

0 comments on commit d78bcf0

Please sign in to comment.