So I have a template that I made to make it so you can multiselect in a dropdown with checkboxes. It works fine except that when I call the preventDefault() on the close: it just makes the dropdown stay on the screen with no way to close it. I was just wondering if there is a better way to approach this. My code for the dropdown is below.
<
body
>
<
div
>
<
input
id
=
"comboBox"
/>
</
div
>
</
body
>
<!-- Template -->
<
script
type
=
"text/x-kendo-template"
id
=
"scriptTemplate"
>
<
input
type
=
"checkbox"
name
=
"#= text #"
value
=
"#= value #"
${selected ?"checked" : "" }/>
<
span
> #= text # </
span
>
</
script
>
<!-- ComboBox initialization -->
<
script
type
=
"text/javascript"
>
var testData = function (text, value, selected) {
this.text = text;
this.value = value;
this.selected = selected;
};
$(document).ready(function () {
var data = [
new testData("Test1", "1", false),
new testData("Test2", "2", false),
new testData("Test3", "3", false),
new testData("Test4", "4", false)];
$("#comboBox").kendoComboBox({
dataTextField: "text",
dataValueField: "value",
template: $("#scriptTemplate").html(),
dataSource: data,
placeholder: "Select...",
close: function (e) {
e.preventDefault()
}
});
var ddl = $("#comboBox").data("kendoDropDownList")
});
</
script
>
</
html
>