#Building your own UI
Unlike other classical DataGrid components out there, the Adaptable DataGrid gives you a lot more flexibility for building and customizing the user interface to suit your needs.
In your app, you need to render <adaptable-provider> with the data and the state, but this doesn't produce anything visible itself.
What you place inside it, in the same template, decides what users see. Most people will generally have <adaptable-workspace />, which renders the full product - grid, dashboards and settings panel. However, all of the following components can be rendered inside the provider and will pick up the Adaptable state automatically:
<adaptable-workspace>— renders a resizable & collapsible panel with 2 sides:<adaptable-ui>on one side, the settings panel on the other side.<adaptable-ui>— the grid with its dashboard.<adaptable-data-grid>— only the grid.- UI components —
<adaptable-data-grid>,<adaptable-dashboard>, the view picker, quick search, the column chooser, the settings panel and each of its pages, to lay out yourself.
They are standalone components: list their classes (AdaptableWorkspace,
AdaptableUI, AdaptableDataGrid, …) in the imports of your component.
<Adaptable.Workspace />The DataGrid with its four dashboards, plus the SettingsPanel, split by a resizable, collapsible divider.
<Adaptable.UI />The DataGrid with its four dashboards. The SettingsPanel opens in a dialog if not rendered elsewhere inside the <Adaptable.Provider />.
<Adaptable.UI.DataGrid />The DataGrid alone.
UI componentsIndividual pieces, placed wherever you like in your own layout.
#Adaptable Workspace
<adaptable-workspace> is the batteries-included option: it gives users the grid,
the dashboard and every settings page, without any layout work.
<adaptable-provider adaptableId="my-app" primaryKey="id" [data]="data" [defaultState]="defaultState">
<adaptable-workspace />
</adaptable-provider>Read more on how you can customize the workspace.
The demo below shows the default configuration of the workspace.
The workspace can stack the settings panel beside the grid or above and below it, and show only the grid in the main pane. Try the options in the demo below.
#The grid and its dashboard
<adaptable-ui> leaves out the settings panel. Whenever the settings panel is not rendered explicitly, it will open in
a dialog, from the dashboard's settings buttons or by calling
adaptableApi.settingsPanelApi.showSettingsPanel().
<adaptable-provider adaptableId="my-app" primaryKey="id" [data]="data" [defaultState]="defaultState">
<adaptable-ui />
</adaptable-provider>#Your own layout
The UI components can go anywhere inside the provider: an app header, a sidebar, a dialog. They all read and write the same state, so they stay in sync wherever they are placed — a view picked in your header is the view the grid shows, and the settings panel edits the same views.
<adaptable-provider adaptableId="my-app" primaryKey="id" [data]="data" [defaultState]="defaultState">
<header>
<adaptable-view-picker />
<adaptable-quick-search />
</header>
<adaptable-data-grid />
<adaptable-overlays />
</adaptable-provider>The overlays (the settings dialog, notification toasts and cell note popovers)
are part of <adaptable-ui>. When you compose the grid from
<adaptable-data-grid> instead, render <adaptable-overlays /> once
anywhere inside the provider, as above. The overlays open on top of the page,
so where you place it doesn't change the layout.
#Where popups are rendered
Column and context menus, selects, comboboxes, popovers, tooltips and dialogs
are rendered into an element appended to document.body, so they are never
cut off by the pane they open from. Column and context menus are kept within
the <adaptable-workspace>, or within the grid when there is no workspace.
To render them somewhere else - for example inside an element shown full screen -
pass portalContainer to the provider:
import { Component, ElementRef, viewChild } from '@angular/core';
import {
AdaptableProvider,
AdaptableWorkspace,
type AdaptableUserState,
} from '@adaptabletools/datagrid-angular';
declare const data: unknown[];
declare const defaultState: AdaptableUserState;
@Component({
selector: 'app-grid',
imports: [AdaptableProvider, AdaptableWorkspace],
template: `
<adaptable-provider
adaptableId="my-app"
primaryKey="id"
[data]="data"
[defaultState]="defaultState"
[portalContainer]="popupsContainer"
>
<adaptable-workspace />
</adaptable-provider>
<div #popups></div>
`,
})
export class AppGrid {
protected readonly data = data;
protected readonly defaultState = defaultState;
private readonly popups = viewChild.required<ElementRef<HTMLDivElement>>('popups');
protected readonly popupsContainer = () => this.popups().nativeElement;
}#Next steps
- Workspace — panel position, sizing, collapsing and a custom main pane
- UI components — every part, and the settings pages you can embed on their own
- Building blocks — buttons, selects and other controls for your own toolbars