我在Extjs中的商店遇到了奇怪的问题。我的ASP.NET MVC3控制器返回JSON:

enter image description here

我的商店:

Ext.define('MyApp.store.Users', {
    extend: 'Ext.data.Store',
    config: {
        // I know the model works
        model: 'MyApp.model.User',
        storeId: 'Users',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            url: 'users/read',
            reader: {
                type: 'json',
                root: 'users'
                // also tried this
                rootProperty: 'users'
            }
        }
    }
});

现在,当我将这家商店连接到内部的网格 ExtJS 4.2.1, ,网格显示 两行,但没有数据. 。当我 console.log(store) 我只看到内部的数据 raw property, ,不在里面 data property.

有人知道有什么问题吗?为什么没有映射?网格的数据登录也与模型字段相同(我已经使用PHP完成了一千次,我不知道这里的问题在哪里。)

我尝试的还有一件事。我试过了 renderer: function(value) { console.log(value); } 在网格的专栏内,我只是得到 undefined.

编辑:这就是JSON实际上的样子:

enter image description here

有帮助吗?

解决方案 2

Sencha到底是什么? sencha touch 2总是说把所有东西都放在 config?现在,当我在Extj中这样做时,一切都会破裂?

我从 config: {} 现在效果很好。

其他提示

尝试使用 root: 'users' 不是 rootProperty. 。如果未指定 root 默认为 ''.

Sencha文档

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top