Skip to content

Web Components for Insights Hub and Industrial IoT
Context

The context attribute may be used to control the behavior of fetching and displaying data when the component is used multiple times.

By default, components of same type share the same context. I.e., they fetch the data once and reuse it. Filter or search applied to one component instance affects all component instances within the same context.

Example

When using multiple Asset View components simultaneously, they have the same context, if not assigned otherwise. If the user filters for specific assets in one Asset View component, the other components would apply the same filter. This is avoided by applying a different context value for each component. In this case the data is fetched separately for each context.

If an Asset View component is used inside a dialog box, the context enables the component to reuse the fetched data although the component is destroyed every time the dialog box is closed.

<html>
<head>
  <title>Context Example</title>
</head>
<body>

  <!-- Dialog Box Element-->
  <div class="dialog-box">
  <!-- .... -->
    <mdsp-asset-view context="dialog-context"></mdsp-asset-view>
  <!-- .... -->
  </div>

  <!-- Main Page Element -->
  <div class="main-container">
  <!-- .... -->
  <div class="asset-navigation">
    <mdsp-asset-view context="asset-navigation"></mdsp-asset-view>
  </div>
  <!-- .... -->
  </div>

  </html>  
</body>

Last update: February 23, 2024

Except where otherwise noted, content on this site is licensed under the Development License Agreement.