【问题标题】:Add value to extjs textarea from store从商店为 extjs textarea 添加价值
【发布时间】:2013-05-16 16:08:19
【问题描述】:

我想从 mongo 数据库中获取数据并将其添加到 extjs 文本区域。

一切准备就绪,我的 mongo 数据库返回我想要添加到 extjs 文本区域的用户电子邮件地址列表。

我使用这个代码:

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);

但我收到此错误:

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

这是我的商店

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
            });
        }
    }
}
});

【问题讨论】:

    标签: extjs extjs4 textarea store


    【解决方案1】:

    试试这个

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

                    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;
    
                        }
                      }
    

    【讨论】:

      猜你喜欢
      • 2011-12-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-18
      • 2020-03-02
      • 2012-12-04
      • 2015-05-26
      • 1970-01-01
      • 2021-11-17
      相关资源
      最近更新 更多