I've solved with this custom binding found on this question.
ko.bindingHandlers.chosen = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
$(element).chosen();
},
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var value = ko.unwrap(valueAccessor()); // - see comment
$(element).trigger("liszt:updated");
}
};
Note that if you don't use ko.unwrap
, the update function will not fire, as it has been told to me in this question relating to this issue.