Extjs 多个存储加载问题Sencha Touch

Extjs 多个存储加载问题Sencha Touch,extjs,model-view-controller,sencha-touch,sencha-touch-2,store,Extjs,Model View Controller,Sencha Touch,Sencha Touch 2,Store,我有两个商店“Poll”和“Choices”,分别有“Poll”和“Choice”两种型号 模型 民意测验 选择 商店 民意测验 选择 因此,我可以从轮询存储区填充列表,单击列表项后,控制器将详细信息面板推送到视图中。选项存储将根据列表上发生的点击事件填充。因此,问题是我必须在加载选项存储后才能将“详细信息”面板推送到视图中 我该怎么做??欢迎提出建议 我的控制器看起来像这样 Ext.define('PollsTest.controller.MainController', { extend:

我有两个商店“Poll”和“Choices”,分别有“Poll”和“Choice”两种型号

模型

民意测验

选择

商店

民意测验

选择

因此,我可以从轮询存储区填充列表,单击列表项后,控制器将详细信息面板推送到视图中。选项存储将根据列表上发生的点击事件填充。因此,问题是我必须在加载选项存储后才能将“详细信息”面板推送到视图中

我该怎么做??欢迎提出建议

我的控制器看起来像这样

Ext.define('PollsTest.controller.MainController', {
extend: 'Ext.app.Controller',


requires : ['PollsTest.controller.ChoiceController'],

config: {





    refs: {
        mainController : 'mainpanel',
        controller_list : 'pollslist',
        details_controller : 'pollsdetails'
    },
    control: {

        controller_list : 
                    {
                        itemtap : 'ShowPoll'
                    },



            }

            },

ShowPoll : function (list, index, target, record, e, eOpts)
                {   
                   var tochoice = record.data.uri;

                   var main_path = 'http://localhost';
                   var choices_url = main_path+tochoice;

                   var choice_store_object = Ext.getStore('choiceStore');
                   choice_store_object.getProxy().setUrl(choices_url);
                   choice_store_object.load();

                   console.log(choice_store_object.getCount());

                /*   var choices_store_object = Ext.create('PollsTest.store.Choices');

                   var checking = choices_store_object.on('load',function(){return true;});

                   if(checking==true) --> didn't work no detail panel pushing is happening but the order of loading the stores works fine here. 
                        {
                 */     console.log('before pushing');
                        this.getMainController().push({xtype : 'pollsdetails',data : record.data });
                        console.log('after Pushing');

                 //       }












                //this.getApplication().getController('ChoiceController').onDetailsShow(this,record,tochoice);   






                }








 });

您可以在选择存储加载函数中传递回调函数。回调函数将在存储加载后执行

choice_store_object.load(function(records, operation, success) {
    // push the pollsdetails view here
}, this);     

这就是我实施的方式

var choices_store_object = Ext.create('PollsTest.store.Choices');

                   var checking =choice_store_object.load(function(records, operation, success)

                    {


                                    console.log('before pushing');
                                    this.getMainController().push({xtype : 'pollsdetails',data : record.data });
                                    console.log('after Pushing');            






                   }, this);

`

未捕获类型错误:对象[Object Object]没有“getMainController”方法加载存储的顺序正常。但是pollsdetails视图仍然没有被推送到视图??怎么办?解决作用域是否有问题?现在遇到新问题存储中的所有数据都标记为phantom:true
Ext.define('PollsTest.store.Choices',{

extend : 'Ext.data.Store',
alias : 'store.choiceStore',        

requires : 
            [
                'PollsTest.model.Choice'
            ],


config :
        {   
            autoLoad : false,
            model : 'PollsTest.model.Choice',
            storeId :'choiceStore',

            listeners : 
                {
                    load : function(store, records)
                            {
                                console.log('choice store loaded',records);
                            }

                },


            proxy :
                {
                    type : 'jsonp',
                    url : '',

                    reader : 
                        {
                            type: 'json',
                            rootProperty : 'choices'
                        }

                }


        },




});
Ext.define('PollsTest.controller.MainController', {
extend: 'Ext.app.Controller',


requires : ['PollsTest.controller.ChoiceController'],

config: {





    refs: {
        mainController : 'mainpanel',
        controller_list : 'pollslist',
        details_controller : 'pollsdetails'
    },
    control: {

        controller_list : 
                    {
                        itemtap : 'ShowPoll'
                    },



            }

            },

ShowPoll : function (list, index, target, record, e, eOpts)
                {   
                   var tochoice = record.data.uri;

                   var main_path = 'http://localhost';
                   var choices_url = main_path+tochoice;

                   var choice_store_object = Ext.getStore('choiceStore');
                   choice_store_object.getProxy().setUrl(choices_url);
                   choice_store_object.load();

                   console.log(choice_store_object.getCount());

                /*   var choices_store_object = Ext.create('PollsTest.store.Choices');

                   var checking = choices_store_object.on('load',function(){return true;});

                   if(checking==true) --> didn't work no detail panel pushing is happening but the order of loading the stores works fine here. 
                        {
                 */     console.log('before pushing');
                        this.getMainController().push({xtype : 'pollsdetails',data : record.data });
                        console.log('after Pushing');

                 //       }












                //this.getApplication().getController('ChoiceController').onDetailsShow(this,record,tochoice);   






                }








 });
choice_store_object.load(function(records, operation, success) {
    // push the pollsdetails view here
}, this);     
var choices_store_object = Ext.create('PollsTest.store.Choices');

                   var checking =choice_store_object.load(function(records, operation, success)

                    {


                                    console.log('before pushing');
                                    this.getMainController().push({xtype : 'pollsdetails',data : record.data });
                                    console.log('after Pushing');            






                   }, this);