Implementing Node Views (Optional)

Node views allow you to display alternate information on a node. Using node views, you can determine which attributes to show in the node based on the organization chart’s node display template. For instance, one node view might show a person’s name, photo, and job information, while another view might show that person’s name and contact information.

Users are able to select different node views of the organization chart to see less or more data in the nodes. When node views are implemented for an organization chart, the chart displays a view controller that enables a user to select a node view.

You can define multiple node views for an organization chart. A node view definition would include a full definition of the node contents defined by the following attributes:

  • Which icons are displayed.

  • Which descriptors are displayed.

  • The style of the node descriptor.

  • The position of the descriptors on the node.

Node View Controller

The node view controller appears in the top part of the chart above the nodes but below any chart breadcrumbs or legend. The node view controller is made up of push buttons without text where each button represents a view. A data hint is used to provide the text description of the view.

The node view controller in this example displays the “Personal” node view data hint:

Node view controller with a data hint

Creating Node Views

To set up the node view controller to enable node views, use the following two organization chart methods:

&oOrgChart.SetNodeViewEntries(&NodeViewArray);
&oOrgChart.SetNodeViewText(&NodeViewText);

NodeViewArray represents an array of node view IDs. NodeViewText is an array of data hints for each corresponding node view ID.

Additionally, the organization chart property, InitialView, must be set to indicate which view is initially displayed in the chart. For example, the property might be set as follows to show the view that is labeled “Personal.”

&OrgChart.InitialView="VIEW1";

The following example shows an organization chart with three node views defined:

Organization chart with three node views

Transitioning between node views will be done without a server trip. Therefore, it’s not possible to have a field change event when changing between views. Also, once the user navigates away from the chart or the chart is refreshed, the current view state is not saved. Therefore, the chart will always show the initial view set in the chart property whenever the chart is viewed again.