2013-12-11 38 views
0

我有附加到APP的區域。嵌入佈局訪問子區域

iApp.addRegions({ 
    sregion : "#sregion" 

});

該區域被附接到佈局基本上是應用程序的佈局,其具有inturn區域

var iLayout = Marioneete.Layout.extend({ 
    template : LayoutTemplate, 
    regions : { 
     mainheader : "#mainheader", 
     menu : "#mainmenu", 
     content : "#mcontent" 
    } 

最後區域(內容)被再次佈局

template : MainContentLayout, 
    regions : { 
     contentmainheader : "#headmain", 
     cotenttable : "#tablecontainer", 
     cotentdetailer : "#issuedetailer" 
    } 
}); 

我在控制器通過存儲this.applayout主頁面事件,以便我可以訪問其他事件發生時的視圖,如下所示。

   var MyApp = require('mapp'); 
       mlayout = new AppLayout(); 
       MyApp.sregion.show(mlayout); 
       this.applayout = mlayout; 

在所選擇項同一個控制器點擊我試圖訪問其他「內容詳圖」,如下這是行不通的。

   this.applayout.content.cotentdetailer.show(new SelectedIssue({id:options})); 

我們如何真正從主區域/佈局訪問嵌套視圖?我沒有看到這方面的任何方法?

回答

0

您需要創建每個佈局,並把它們在正確的區域第一:

//same as above, but I used correct parent layout 
var MyApp = require('mapp'); 
this.ilayout = new iLayout(); 
MyApp.sregion.show(this.ilayout); 

//You didnt include all your source code for this layout so I am guessing on the variable name. 
this.mLayout = new mLayout(); 
this.ilayout.content.show(this.mLayout) 

//now you can access contentdetailer 
this.mLayout.contentdetailer.show(new SelectedIssue({id:options})) 
0

的問題已基本訪問是在另一個區域佈局的區域。做了一些研究,發現需要訪問currenView然後區域。我正在朝這個方向思考。無論如何,它是像下面解決。

this.applayout.content.currentView.cotentdetailer.show(new SelectedIssue({id:id}));