Sencha touch 从Sencha Touch商店获得特定价值?

Sencha touch 从Sencha Touch商店获得特定价值?,sencha-touch,sencha-touch-2,sencha-architect,Sencha Touch,Sencha Touch 2,Sencha Architect,我创建了一个具有以下结构的模型: 型号代码: Ext.define('MyApp.model.FavoriteScreen', { extend: 'Ext.data.Model', config: { fields: [ { name: 'Name' }, { name: 'ScreenId' } ] } Ext.define('MyApp.store.Favor

我创建了一个具有以下结构的模型:

型号代码:

Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',

config: {
    fields: [
        {
            name: 'Name'
        },
        {
            name: 'ScreenId'
        }
    ]
}
Ext.define('MyApp.store.FavoriteStore', {
extend: 'Ext.data.Store',

requires: [
    'MyApp.model.FavoriteScreen'
],

config: {
    autoLoad: true,
    model: 'MyApp.model.FavoriteScreen',
    storeId: 'FavStore',
    proxy: {
        type: 'ajax',
        api: {
            read: '/api/sample/FavoriteList'
        },
        headers: {
            'Content-Type': 'application/json; charset=UTF-8'
        },
        reader: {
            type: 'json',
            rootProperty: 'data'
        }
    }
}
}))

我创建了一个具有以下结构的商店:

商店代码:

Ext.define('MyApp.model.FavoriteScreen', {
extend: 'Ext.data.Model',

config: {
    fields: [
        {
            name: 'Name'
        },
        {
            name: 'ScreenId'
        }
    ]
}
Ext.define('MyApp.store.FavoriteStore', {
extend: 'Ext.data.Store',

requires: [
    'MyApp.model.FavoriteScreen'
],

config: {
    autoLoad: true,
    model: 'MyApp.model.FavoriteScreen',
    storeId: 'FavStore',
    proxy: {
        type: 'ajax',
        api: {
            read: '/api/sample/FavoriteList'
        },
        headers: {
            'Content-Type': 'application/json; charset=UTF-8'
        },
        reader: {
            type: 'json',
            rootProperty: 'data'
        }
    }
}
}))

现在我想从这个存储中获取特定的记录,但我的存储不返回任何值。为了从存储中获取价值,我编写了以下代码行:

var myStore = Ext.getStore('FavStore');

myStore.load({
    scope: this,
    callback: function (records, operation, success) {
        if (success) {
            Ext.Msg.alert(myStore.getAt(0).getData());
        }
    }
});
上面的代码是我在nestedlistleafitemtap事件中编写的代码


感谢您的帮助

首先-不要使用getData()-例如使用
get('name')


第二,尝试在加载调用之前和回调函数内部添加日志记录。通过这种方式,您可以查看是否已开始加载以及加载是否已完成

在回调函数中,您可以看到
记录中有什么内容吗?