Skip to content Skip to sidebar Skip to footer

Treeview Checkbox Selection With Graph Updation Is Not Working Properly

In my project i have chart and treeview while pageload chart update is not working properly means here in treeview only two checkboxes are checked in pageload but chart is displayi

Solution 1:

Define a redrawChart that refreshes the Chart with the new series as:

functionredrawChart() {
    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();
}

This functions needs to be invoked:

  1. On your tree change.
  2. After setting the initial visible series.

In addition, move the selection of the initial series to the end of the JavaScript code. I mean, first initialize treeview and chart and only then initialize the initial values.

tree.dataItem(".k-item:nth(2)").set("checked", true);
tree.dataItem(".k-item:nth(3)").set("checked", true);
updateChks();
redrawChart();

The complete running version is in here http://jsfiddle.net/OnaBai/RHh67/68/

Post a Comment for "Treeview Checkbox Selection With Graph Updation Is Not Working Properly"