Using a view container
This article shows you how to use a view container component to embed another dashboard, report, or scorecard within your current view.
2. Add a view container component
For this example, create a new dashboard (Dashboard1) using the Blank template. Add a chart (metric set) to the dashboard and resize the dashboard smaller so it just fits the chart. This small dashboard will be embedded into another dashboard using a view container.
Create a second dashboard (Dashboard2) also using the Blank template. Go to the toolbar, click Components, and then click Container. This will add an empty view container to the canvas.
Go to the Explore window and drag Dashboard1 onto the empty view container. Dashboard1 will be embedded within the view container.
Switch to View mode and right-click over the embedded dashboard/chart. You'll see a context menu with a limited set of options such as Drill Down, Drill Up, Change Level, and Re-Visualize. Note that other context menu options that you normally see such as Annotate, Share, Edit, and Data Binding Panel are not applicable for an embedded view and will not appear.
3. Embed a scorecard
Instead of adding an empty view container to the canvas first, you can simply drag a view (dashboard, report, or scorecard) from the Explore window directly to the canvas. A view container will be created automatically and used to contain the dragged view.
For example, drag a scorecard from Explore to the canvas.
Go to Properties and you'll see that the view container has been created automatically.
In Dundas BI version 2.5 or earlier, view containers were based on iFrames. But in Dundas BI 2.6 or later, new view containers that you create do not use iFrames anymore. You can check which kind of view container you have by going to its Properties:
- If the Name of the view container is viewContainer1 or similar, you are likely using the old iFrame-based view container.
- If the Name of the view container is subCanvasViewContainer1, you are using the new iFrame-less or 'sub-canvas' view container.
Regarding the iFrame-less view container, there are some important implications for scripts running within embedded dashboards and controls. Because iFrames are no longer involved, most uses of dundas.context.* now refer to the context of the main canvas instead of the embedded one. For example, dundas.context.baseViewService.currentView is commonly called to get a reference to the current dashboard. If you call this within an embedded canvas (i.e. sub-canvas), the dashboard/report/scorecard of the main canvas will be returned, which is likely not what you want.
Only the following calls are context-independent and will work with either type of view container:
All other dundas.context.* calls should be replaced with this.getService("BaseViewService"), etc.
For convenience, in most cases, you can call this.baseViewService to get the BaseViewService, or this.parentView to get the CanvasAdapter (replacing dundas.context.canvasService.canvasAdapter).