1
私が働いて複数選択のjsfiddleを取得しようとしているではないですが、私は、コンソールにエラーが表示されます。Javascriptを - CategorySelectはコンストラクタ
CategorySelectが
がどのようにコンストラクタではありません私のCategorySelectコンストラクタではない?
コード:
var CategorySelect = (function() {
function CategorySelect() {
var _this = this;
this._configureMultiselect = function() {
_this._multiselectConfiguration = {
buttonWidth: '100%',
buttonContainer: '<div style="height: 64px;" />',
buttonClass: 'none',
nonSelectedText: "select category",
includeSelectAllOption: true,
disableIfEmpty: true,
onSelectAll: function() {
if (!$("#category-div span.multiselect-selected-text").text()) {
$("#category-div span.multiselect-selected-text").text('Select category');
}
},
onChange: function(option, checked) {
_this._selectedCategories = ko.observableArray([]);
var self = _this;
$('#category-select option:selected').each(function() {
self._selectedCategories.push(($(this).text(), $(this).val()));
});
console.log(_this._selectedCategories());
}
};
};
this._instantiateCategories = function() {
_this._categories = ko.observableArray([
new Category("Vegan Meat", 1),
new Category("Vegan Dairy", 2),
new Category("Confectionary", 3),
new Category("Baking", 4),
new Category("Dessert", 5),
new Category("Restaurants", 6),
new Category("Grocers", 7)
]);
};
this._configureMultiselect();
this._instantiateCategories();
$("#category-select").multiselect(this._multiselectConfiguration);
}
return CategorySelect;
})();