Managing Interactions Between Widgets

You can use the Publish/Subscribe protocol for your City widgets. Changes made to the content of a City experience displayed in a City widget through this protocol will be persisted the same way they are persisted when coming from the widget's user interface. For more information on this protocol, see 3DEXPERIENCE Developer Assistance: Dashboard Apps JavaScript: Widget Interactions: Between Widgets: Using Publish/Subscribe Protocol.

Depending on the preferences, City widgets are able to communicate with other widgets available on the same dashboard. They will publish some topics to inform other widgets of status changes within the City widget (for example, when an experience is loaded, a camera has been moved, or an item has been selected). They can also subscribe to predefined topics to let other widgets take control of the City widget (for example, to move the camera to a specific location, or to change the visibility of one layer).

To keep messaging within the dashboard considered only by the intended target widgets, City widgets provide a pairing mechanism on top of the publish/subscribe protocol. When this mechanism is used, City topics will emit a message to the expected paired widget, that should consider the message only if they are paired as well. To initiate the pairing between two widgets on the same dashboard, proceed as explained in the steps below.


Before you begin: If you restore the City experience from 3DSpace without having previously saved it through the Save City Experience or Save City Experience As... command, changes made through the public API will be lost when reloading the page.
  1. Load City Referential.
  2. On the top-right of the City widget, click .
  3. Select Preferences.
  4. In the Subscribe Event list, click From paired widget only.
  5. Optional: Customize the widget title to avoid confusion with another City widget on the same dashboard.
  6. Add or load the widget to be paired.

    If the widget supports the pairing mechanism, it should provide a button or option to initiate the pairing with the City widget. Otherwise, you can retrieve the title or identifier of the additional widget from the City widget preferences.

    The target widget displays a dialog box to confirm the association with the source widget.
  7. In the City widget, click OK in the Widget Pair Request dialog box to approve the pairing.
  8. From the View section of the action bar, click Preferences .
    If the pairing is successful, the list of paired widgets is displayed in the Paired Widgets list.

    Once the two widgets are successfully paired together, they can exchange further messaging through different topics that are grouped into selectable levels of control:

    • Basic topics related to selection and click that occurs within the City viewer.
    • Basic topics related to the control of the camera location sent from an additional widget.
    • Getter/setter allowing the additional widget to modify the visibility or the rendering options of city datasets and items.
    Tip: If your dashboard is simple enough, the alternate City widget option might be more relevant to interact with all widgets located on the same tab, or even with all widgets in the same dashboard.

    For more information about developing your own widget to interact with City ones, see 3DEXPERIENCE Developer Assistance.

  9. To break the connection, click Remove from the Paired Widgets list in the experience preferences.