小编jir*_*_cs的帖子

Sencha - store.each() - 数据不可用,它们只在数据类中很深

我有:

Ext.define("catcher.view.Login", {
   extend: "Ext.form.Panel",
// creating login form, including selectfield
Run Code Online (Sandbox Code Playgroud)

商店"锦标赛"在商店中创建(autoload:true),有其模型.一切都准备好了.需要动态填充selectfield(仍在view.Login类中):

initialize: function(){
        var store = Ext.getStore("Tournaments");        
        var options = new Array();
        store.each(function(radek){
            options[radek.get("tournament_id")] = radek.get("tournament_name");
        });
    }
Run Code Online (Sandbox Code Playgroud)

我不想使用store:"Tournaments"配置选项,因为后来的form.submit(); 不发送正确的数据selectfield.

有问题: console.log(store.getCount());返回0.使用store.add({ ... })我可以添加任何东西,getCount()返回corrent count(0 + add()).

奇怪的部分:console.log(store)返回整个类,包括data所有项目内的对象.接下来奇怪的部分 - 如果我在控制器中使用相同的代码,一切正常,Store正确加载,我可以使用mystore.each();

extjs

2
推荐指数
1
解决办法
5209
查看次数

标签 统计

extjs ×1