Skip to content

MindSphere Web Components
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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<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>

Any questions left?

Ask the community


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