从模态控制器分配数据源

Assigning DataSource from Modal Controller

我的模型控制器中有以下代码。尽管我在数据中有一系列对象,但它没有 show/update 图表上的柱状图。

我想知道我哪里做错或遗漏了?

Model.js

var theDataSource = new kendo.data.DataSource({
    data: allData,
    group: {
        field: "series"
    },
    sort: {
        field: "category",
        dir: "asc"
    }
});
chart.dataSource = theDataSource;
chart.refresh();

View.js

$("#chart").kendoChart({
    title: {
        text: "Selection",
        color: "white"
    },
    theme:"Metro",
    seriesDefaults: {
        type: "column",
        stack: true,
    },
    series: [{
        field: "value",
    }]
})

使用setDataSource()设置数据源,这将通知图表数据源已更改。

var theDataSource = new kendo.data.DataSource({
    data: allData,
    group: {
        field: "series"
    },
    sort: {
        field: "category",
        dir: "asc"
    }
});
chart.setDataSource(theDataSource);