我商店中的所有数据都嵌套在一行中

All my datas in my store are nested in one row

我正在使用 admin-dashboard 作为文件夹 extjs6.0.2 (http://examples.sencha.com/extjs/6.0.2/examples/admin-dashboard/#dashboard) and i followed the guide "Backend connectors" with "Direct and php mysql"(http://docs.sencha.com/extjs/6.0.2-classic/guides/backend_connectors/direct/mysql_php.html) 中的模板。

当我将商店更改为“用户结果”中的“搜索结果”时遇到问题。我用后端连接器指南的改编版本替换了静态存储。

Router.php 以 json 格式正确提供数据,但我在网格面板用户结果中只有一个空行。

这是我的商店

Ext.define('Admin.store.import.Users', {
extend: 'Ext.data.Store',

alias: 'store.importusers',

fields: [
    {type: 'int', name: 'id'},
    {type: 'string', name: 'szNomUser'},
    {type: 'string', name: 'szPrenomUser'},
    {type : 'string', name: 'szLoginUser'},
    {type: 'string', name: 'szMailUser'}
],

proxy: {
    type: 'direct',
    api: {
        read: 'QueryDatabase.getUsers'
    },
    reader: {
        type: 'json'
    }
},
autoLoad : true
});

以及查询的结果

{
"type": "rpc",
"tid": 1,
"action": "QueryDatabase",
"method": "getUsers",
"result": {
    "0": {
        "id": "2",
        "szNomUser": "ADMINISTRATEUR",
        "szPrenomUser": "Default",
        "szLoginUser": "admin",
        "szPassWordUser": "admin",
        "szProfilUser": "S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4S",
        "nLangueUser": "1",
        "nRefIdStudioUser": "0",
        "szSuperviseurUser": "0",
        "szTelUser": "",
        "szFaxUser": "",
        "szMobileUser": "",
        "szMailUser": "martinbryan.eu@gmail.com",
        "tDateNaissanceUser": "2004-12-08",
        "bActifUser": "1",
        "szModeWeb": "0",
        "szSuperSuperviseurUser": "0",
        "szGroupUser": "T",
        "szActiviteUser": "1"
    },
    "1": {
        "id": "18",
        "szNomUser": "DETTO",
        "szPrenomUser": "ERNEST",
        "szLoginUser": "ED",
        "szPassWordUser": "ED",
        "szProfilUser": "S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4S\u00a4N",
        "nLangueUser": "1",
        "nRefIdStudioUser": "0",
        "szSuperviseurUser": "0",
        "szTelUser": "",
        "szFaxUser": "",
        "szMobileUser": "",
        "szMailUser": "",
        "tDateNaissanceUser": "0000-00-00",
        "bActifUser": "0",
        "szModeWeb": "0",
        "szSuperSuperviseurUser": "0",
        "szGroupUser": "",
        "szActiviteUser": "1"
    }
}
}

当我查看 gridpanel 的商店时,我看到了这棵树:

store > data (length 1) > items (length 1)> [0] > data 在最后的数据中,我有我所有的数据,所有字段都是空的。 这个例外 Ext.data.Model#persistenceProperty最后一个数据的属性集之前。

当然我的网格面板的列有正确的 dataIndex。

嗯,

我的数据格式不正确,我查看了来自 extjs 6 (http://docs.sencha.com/extjs/6.0.2-classic/guides/backend_connectors/direct/specification.html#backend_connectors--direct--specification_-_remoting_responses) 的 直接规范 (http://docs.sencha.com/extjs/6.0.2-classic/guides/backend_connectors/direct/specification.html#backend_connectors--direct--specification_-_remoting_responses) 如果数据必须 [=18],则不清楚=] 对象或 json 对象的数组。在我的例子中,json 对象数组工作正常。

result — The data returned by the Method. 
MUST be present in the Response object, 
but MAY be null for Methods that do not return any data.


{
"type": "rpc",
"tid": 1,
"action": "QueryDatabase",
"method": "getUsers",
"result": [{
    "nIdUser": "2",
    "szNomUser": "ADMINISTRATEUR",
    "szPrenomUser": "Default",
    "szMailUser": "martinbryan.eu@gmail.com",
    "szLoginUser": "admin"
}, {
    "nIdUser": "18",
    "szNomUser": "DETTO",
    "szPrenomUser": "ERNEST",
    "szMailUser": "",
    "szLoginUser": "ED"
}]
}