【问题标题】:Kendo DataSource and nested JsonKendo DataSource 和嵌套的 Json
【发布时间】:2016-06-24 19:34:55
【问题描述】:

我很难找到准确描述在这种情况下该怎么做的任何文档。

我的DataSource 有以下架构:

schema: {
    model: {
        id: "Id",
        fields: {
            BuyerProfile: [
                {
                    Id: { type: "number" },
                    Name: { type: "string" },
                    City: { type: "string" },
                    State: { type: "string" },
                    Description: { type: "string" },
                    BuyerType: [
                        {
                            Id: { type: "number" },
                            Name: { type: "string" }
                        }
                    ]
                }
            ]
        }
    }
}

我的 JSON 格式正确,我没有收到任何错误。但是,当我尝试在我的剑道模板中打印任何项目时,我只会打印出undefined

例如:

<script type="text/x-kendo-tmpl" id="profileTemplate">
    <p> #:BuyerProfile.Name# </p>
</script>

上面的例子实际上只是在p 标签内打印出undefined。没有 JavaScript 错误或任何东西。

我可能是错的,但我想我在某处读到这就是你如何在 Kendo 中使用嵌套的 JSON 对象。但是,显然不是,因为它不起作用或者我错过了一些东西。

【问题讨论】:

    标签: json kendo-ui


    【解决方案1】:

    您正在寻找的答案可能是herehere。基本上你要么需要解析你的架构,要么只是让你的架构平坦,没有任何嵌套属性。

    【讨论】:

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