Displaying Custom Windows

Summary

  • AdapTable allows developers to provide custom windows
  • These are custom, movable, resizable with bespoke content

AdapTable allows developers to create and display bespoke Windows.

These windows display bespoke content supplied by the developer.

Hint

  • Custom Windows are fully movable and resizable
  • If a user moves or resizes a window, it re-opens with those dimensions and position

Open and close Custom Windows via User Interface API:

  • openCustomWindowPopup — displays a Custom Window using the supplied CustomWindowConfig
  • closeCustomWindowPopup — closes the open window with the given id
Deep Dive

The Custom Window object

Developer Guide

Providing a Custom Window

const config: CustomWindowConfig = {
  id: 'demo_window',
  title: 'Demo Window',
  icon: 'laptop',
  position: {x: 100, y: 100},
  size: {width: 400, height: 300},
  render: context => {
    if (context.phase === 'onMount') {
      return '<div style="padding:10px"><p>Custom window content</p></div>';
    }
    return null;
  },
};
1
Create Custom Window Config

Build a CustomWindowConfig:

  • id — required unique identifier; pass the same value to closeCustomWindowPopup
  • title — label shown in the window header
  • icon — optional AdaptableSystemIconName for the header (e.g. 'laptop', 'search')
  • position — optional initial placement in pixels (x, y) — WindowPosition
  • size — optional initial dimensions (width, height) — WindowSize
  • render — function returning HTML; receives CustomRenderContext (phase, element, adaptableApi). Return markup on 'onMount'; return null on 'onDestroy'.

Users can move and resize the window at run time; AdapTable restores the last position and size when the window opens again.

onClick: (button, context) => {
  context.adaptableApi.userInterfaceApi.openCustomWindowPopup(config);
},
2
Open from application code (e.g. a Dashboard or Toolbar Button)

Call openCustomWindowPopup wherever you have adaptableApi — commonly in a Custom Toolbar Button or Custom Dashboard Button onClick handler.

setTimeout(() => {
  context.adaptableApi.userInterfaceApi.closeCustomWindowPopup('demo_window');
}, 10000);
3
Optionally close the window programmatically

A close button is always shown in the header (not configurable). To close from code, call closeCustomWindowPopup with the config id (for example after a timeout).

Creating a Custom Window
Fork
  • This example contains a Custom Dashboard Button - Show Custom Window - which opens a Custom Window popup that displays the rendered content that was provided
  • The Custom Window is given an initial Size and Position but is also fully movable and resizable by the run-time user
  • The Custom Window contains a Close button for manual close, but is also set programmatically to close after 10 seconds (via closeCustomWindowPopup)
Try It Out
  • Click Show Custom Window — the window opens at the configured position and size; move and resize it as needed
  • Wait 10 seconds — the window closes automatically via closeCustomWindowPopup
  • Open it again — it restores the position and size you last set

Find Out More

It is also possible to display Progress Indicators when running a long task