0

I am creating an application which has multiple views. Each view has got a left sidebar region and a main content region.

I have added two regions in my layout -> leftSidebarRegion and mainContentRegion. Now for each of these views the left sidebar content remains the same, but the mainContentRegion keeps on changing. This change in mainContentRegion is event driven.

I want to know how can I access my layout instance [created once in main controller of my module] so that leftSidebarRegion is not reloaded and I only change mainContentRegion.

Additional information: I have different view files for populating leftSidebarRegion and mainContentRegion.

alchemist
  • 1,081
  • 12
  • 17

1 Answers1

1

You can access the region from the layout object.

var layout = new Layout();

layout.mainContentRegion.show(new ViewYouWantToRender());

The Pax Bisonica
  • 2,154
  • 2
  • 26
  • 45
  • Thanks for the reply, but I think doing new Layout() will create a new instance of my layout so in this case I will have to re render leftSidebarRegion which I dont want to do unless it's not created previously. – alchemist Nov 20 '14 at 10:19
  • Well once the layout is instantiated you don't have to create another instance. If you want to have the layout globally accessible just set it as a variable on the App object when instantiating it in your controller: App.myLayout = new Layout(). – The Pax Bisonica Nov 20 '14 at 16:17
  • Or you could set it as a variable on a module, if you are using one. – The Pax Bisonica Nov 20 '14 at 16:18