Views hierarchy: Accessing Views in the hierarchy

Views hierarchy: Accessing Views in the hierarchy

April 02, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]


One of the main advantages of the hierarchical View composition is the fact that we can access the members of other Views from a given View. So, as we have seen in the previous article, we can access the members of the host (parent) View by simply calling this.Host property on the current View.


Accessing other Views, however, has several limitations which one should bear in mind.
  • Only Views in the current route can be accessed
  • Only parent Views can be accessed (parent cannot access child View)
Before we start to describe these limitations, let us consider the process of how Views are loaded and what is the current View. Namely, every time you access a particular route, you are loading all the Views in that hierarchy, ending with the last one. The current View is always the last View loaded. Let us take a look at the following diagram to understand this mechanism.

In the image above, we see two different routes. If you are accessing the orange route (ControlPanel.ProductsView.ProductNewView), first the ControlPanel View will be loaded, then the ProductsView View will be loaded and finally the ProductNewView View will be loaded. The last loaded View is always the current View, and on the screen the user interface of that View will be displayed.


Only Views in the current route can be accessed

Since, only the Views of the current route are loaded, it follows that only them we can access. Namely, if we take again look at the diagram of the Views and routes, if the blue route is being accessed, we cannot access ProductsTagsView and its members for example, because that View has not been loaded.


Only Parent Views can be accessed

Second rule of the View access it that we can only access the parent Views, through the Host property. Namely, since the Views are being loaded dynamically, the View does not know about its children, until the whole hierarchy is loaded. As it was described in the previous article, we access the parent Views and their members through the Host property.


There are certain workarounds for these limitations, but with proper design of the hierarchy, these limitations never present a problem. In the overview of the ViewModeControl class, which comes at the end of this series, we will examine various properties that will give us sufficient information about Views on either side of the hierarchy.

The Progress Guys

View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
What Serverless Means for Enterprise Apps
Watch Webinar