user2159515
user2159515

Reputation: 35

KendoChart filtering based on the checked event is not working properly

I am doing one project using kendo controls,I have kendo chart and tree-view with check-boxes in my application.My requirement is to filter the kendo chart based on the checked event in tree-view.And here only 2 check-boxes are selecting at a time.On page load only 2 items will be displaying in the chart.

My fiddle is http://jsfiddle.net/RHh67/73/

My treeview on change event code is

$("#treeview").on("change", function (e) {
    var chart = $("#myChart").data("kendoChart");

    var checkedSeries = [];

    $("#treeview").find(":checked").each(function() {
        var nodeText = $(this).parent().parent().text();

        $.each(series, function(index, series) {
            if (series.field == nodeText) {
                checkedSeries.push(series);
            }
        });
    });

    chart.options.series = checkedSeries;
    chart.refresh();
});

Upvotes: 1

Views: 789

Answers (1)

OnaBai
OnaBai

Reputation: 40887

You need to remove extra spaces from you text node... Try adding trim when you compute nodeText on the change handler function:

var nodeText = $(this).parent().parent().text().trim();

Upvotes: 2

Related Questions