0

I want to get data from mongo data base and add it to an extjs text area.

Everything is ready, my mongo data base returns a list of user email addresses that I want to add to the extjs text area.

I use this code:

var index = Ext.StoreMgr.lookup("writeup.store.Employee").findExact('name',name);
var rec = Ext.StoreMgr.lookup("writeup.store.Employee").getAt(index);
alert(rec.data.name);

But I get this error:

TypeError: Ext.StoreMgr.lookup(...) is undefined

And this is my store

Ext.define('writeup.store.Employee', {
extend: 'Ext.data.Store',
model: 'writeup.model.Employee',
autoLoad: true,

proxy: {
    type: 'ajax',
    actionMethods: {
        read   : 'POST'
    },
    api: {
        read : 'user/view.action'
    },
    reader: {
        type: 'json',
        root: 'data',
        successProperty: 'success'
    },
    writer: {
        type: 'json',
        writeAllFields: true,
        encode: false,
        root: 'employee'

    },
    listeners: {
        exception: function(proxy, response, operation){
            Ext.MessageBox.show({
                title: 'REMOTE EXCEPTION',
                msg: operation.getError(),
                icon: Ext.MessageBox.ERROR,
                buttons: Ext.Msg.OK
            });
        }
    }
}
});
4

1 回答 1

0

尝试这个

将此代码加载到您的控制器中

                var store_name = Ext.create('Ext.data.Store', {
                    model: 'model name'
                });
                store_name.load();
                store_name.each(function(record){

                    for(var i=0;i<record.data.yourlocalstorageid.length;i++){
                        var index = record.data.yourlocalstorageid[i].name;

                    }
                  }
于 2013-05-24T05:25:32.977 回答