【问题标题】:Kendoui databind with Jquery datasource not workingKendo Ui 数据与 Jquery 数据源绑定不工作
【发布时间】:2012-06-12 11:30:58
【问题描述】:

您好,我正在尝试将数据绑定到 kendochart,但图表上没有显示条形图。如果我在网络浏览器中获取 url,则会返回以下字符串。

[{"AreaName":"Rondebosch","NumberOfIncidents":2}, {"AreaName":"Claremont","NumberOfIncidents":2}, {"AreaName":"Athlone","NumberOfIncidents":2}]

代码如下

var Reports = {};
    $.ajax({
        url: "Home/getIncidentPerArea",
        async: false,
        dataType: 'json',
        success: function (json) {
            Reports = json;
            $("#Chart").kendoChart({ title: { text: "Incidents Per Area" },
                DataSource: {
                    data: Reports
                },
                series: [{ name: "Incidents Per Area", field:"NumberOfIncidents"}]
        });
    }
});

请帮忙...

【问题讨论】:

    标签: jquery json kendo-ui


    【解决方案1】:

    dataSource 选项以驼峰形式拼写。

    另外data source可以直接请求数据:

    dataSource: {
        transport: {
            read: "Home/getIncidentPerArea"
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      相关资源
      最近更新 更多