【问题标题】:Array/list of strings as a model作为模型的字符串数组/列表
【发布时间】:2014-09-10 15:19:15
【问题描述】:

我正在寻找一种将这样的响应转换为模型(作为模型的字符串列表?)的方法:

{
    "success": true,
    "msg": null,
    "data": [
        "string 1",
        "string 2",
        "string 3",
        "string 4"
    ],
    "errors": null
}

一般情况下,我会使用普通的商店,但是作为模型使用什么?

Ext.define('myStoreName', {
    extend : 'Ext.data.Store', 
    model : ???, //What to use in here, or which store to extend?
    proxy : {
        type : 'betterrest',
        url : 'myUrl',
        headers : {
            'Accept' : 'application/json'
        },
        reader : {
            type : 'json',
            root : 'data',
            totalProperty : 'total',
            successProperty : 'success'
        }
    }
});

【问题讨论】:

    标签: javascript extjs extjs4 extjs4.1


    【解决方案1】:

    使用Ext.data.ArrayStore:

    帮助从数组数据创建 Ext.data.Stores 的小助手类更容易。 ArrayStore 将自动配置 Ext.data.reader.Array。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 2019-03-21
      • 1970-01-01
      • 1970-01-01
      • 2014-10-14
      • 1970-01-01
      相关资源
      最近更新 更多