【问题标题】:How to display nested json using tpl in extjs4如何在 extjs4 中使用 tpl 显示嵌套的 json
【发布时间】:2013-05-02 12:22:52
【问题描述】:

我正在使用 extjs4 + yii 框架。我的服务器端在 yii[php] 中,客户端在 extjs4 中。我正在以 json 格式从服务器端发送数据。 我有 json as-

{
    "data": {
        "Meaning": [
            {
                "Noun": "sea"
            },
            {
                "Adverb": "Null"
            },
            {
                "Adjective": "Null"
            }
        ],
        "pronunciation": "sea",
        "Media": [
            {
                "image": "abc.jpg"
            },
            {
                "image": "xyz.jpg"
            },
            {
                "Video": "Windows Media Audio/Video file (.wmv)"
            }
        ]
    }
}

我想在使用 tpl 的 extjs 视图中显示这个 json。那么如何使用 extjs tpl 显示这个嵌套的 json 呢?

【问题讨论】:

标签: php json yii extjs4 nested


【解决方案1】:

简单的解决方案:

Ext.widget('panel', {
    renderTo: Ext.getBody()
    // 4 is the number of indentation spaces
    ,tpl: '<pre>{[JSON.stringify(values, null, 4)]}</pre>'
    ,height: 400
    ,data: ... // sample data
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 2020-11-13
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    相关资源
    最近更新 更多