kendoCheckBoxGroup on change unable to fetch selected values

1 Answer 86 Views
CheckBoxGroup
Optcodes
Top achievements
Rank 1
Optcodes asked on 18 May 2022, 02:12 PM

on change event - unable to fetch selected values.

Please advise.

<script>

    $(document).ready(function () {

        $("#chk").kendoCheckBoxGroup({
            layout: "vertical",
            autoBind: false,
            items: ["item 1", "item 2", "item 3"],
            
            change: function (e) {

                chkChanged();

            }           
        });
    });

chkChanged = function () {

    debugger;
    var displaynames = $("#chk").kendoCheckBoxGroup().data("kendoCheckBoxGroup");
    var value = displaynames.value().join(",");

    console.log(value)
    
}
</script>


1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 23 May 2022, 10:40 AM

Hello, Meiri,

Thank you for the provided code snippet. The reason for the issue is due to the color part of the line below:

$("#chk").kendoCheckBoxGroup().data("kendoCheckBoxGroup");

It creates a new instance of the widget and messes the correct execution of the rest of the event handler. I have modified the example as needed.

Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
CheckBoxGroup
Asked by
Optcodes
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or