This is a migrated thread and some comments may be shown as answers.

multi-select dropdown question

2 Answers 230 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 16 Aug 2012, 03:03 PM
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>

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 22 Aug 2012, 08:42 PM
Found solution.
0
TJefferson
Top achievements
Rank 1
answered on 28 Aug 2012, 04:12 PM
What was your solution, Chris?
Tags
ComboBox
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
TJefferson
Top achievements
Rank 1
Share this question
or