# Suspending Adaptable Objects

Canonical page: https://www.adaptabletools.com/docs/dev-guide-adaptable-state-suspending

- Suspendable Adaptable Objects can be turned off with `IsSuspended: true` without deleting them from State
- Suspend / unsuspend from the Settings Panel toggle, or via Module API (`suspend…` / `unSuspend…`)
- Not every object type supports suspension (e.g. Layouts, Calculated Columns)

Many objects in AdapTable derive from [`SuspendableObject`](https://www.adaptabletools.com/docs/reference/suspendableobject.md) (which itself derives from `AdaptableObject`).

Not all AdapTable Objects can be suspended — for some it makes no sense, e.g. [Layouts](https://www.adaptabletools.com/docs/handbook-layouts/index.md) or [Calculated Columns](https://www.adaptabletools.com/docs/handbook-calculated-column/index.md)

The interface exposes a single `IsSuspended` property:

| Property | Type | Description |
| --- | --- | --- |
| [IsSuspended](https://www.adaptabletools.com/docs/reference/suspendableobject.md#issuspended) | `boolean` | Suspends (i.e. turns off) an Adaptable Object |
| [IsReadOnly](https://www.adaptabletools.com/docs/reference/suspendableobject.md#isreadonly) | `boolean` | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of &#39;Full&#39;) |

When this property is `true`, the object becomes inactive but remains in [Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state/index.md).

You can set it in [Initial Adaptable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state-initial-state/index.md) (so objects ship inactive), or toggle it at run-time.

Suspendable Objects display a toggle in the [Settings Panel](https://www.adaptabletools.com/docs/ui-settings-panel/index.md) so users can suspend or unsuspend without deleting the object

- All [API classes](https://www.adaptabletools.com/docs/technical-reference-adaptable-api/index.md) that deal with Suspendable Objects expose **suspend** and **unSuspend** methods
- For example, `suspendCustomSort` / `unSuspendCustomSort` in [Custom Sort API](https://www.adaptabletools.com/docs/technical-reference-custom-sorting/index.md), or `suspendGridFilter` / `unSuspendGridFilter` on the Grid Filter API

**Example: Suspending Objects**

Ship a Format Column and Grid Filter with `IsSuspended: true`, then unsuspend them at run-time

- This demo includes a [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md) on `Name` (blue) and a [Grid Filter](https://www.adaptabletools.com/docs/handbook-grid-filter/index.md) — both with `IsSuspended: true`
- On load neither applies: `Name` is unstyled and all rows are visible
- Unsuspend to activate each object without recreating it

- Open **Settings Panel → Format Column** and toggle the suspended Format Column **on** — `Name` turns blue
- In the **Grid Filter** toolbar, click **Unsuspend** — only `JavaScript` and high `Github Stars` rows remain
- Suspend either again to turn it off while keeping the definition in State

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Suspending Objects Demo',
  initialState: {
    Dashboard: {
      ModuleButtons: ['FormatColumn'],
      PinnedToolbars: ['GridFilter'],
    },
    Theme: {CurrentTheme: 'dark'},
    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-name-suspended',
          Scope: {
            ColumnIds: ['name'],
          },
          Style: {
            BackColor: '#1e88e5',
            ForeColor: 'var(--ab-color-palette-14)',
            FontWeight: 'Bold',
          },
          // Inactive until unsuspended — Name stays unstyled on load
          IsSuspended: true,
        },
      ],
    },
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'github_watchers',
            'license',
            'created_at',
            'description',
            'open_issues_count',
          ],
          GridFilter: {
            Expression: '[language]="JavaScript" AND [github_stars]>1000',
            // Expression is stored but not applied until unsuspended
            IsSuspended: true,
          },
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

### FAQ

**What is the difference between suspending and deleting an object?**
- Suspend keeps the object in Adaptable State (`IsSuspended: true`) but stops it applying
- Delete removes it entirely. 
Prefer suspend when you may want the definition again later.

**Can I ship objects already suspended in Initial State?**
Yes. Set `IsSuspended: true` on the object in Initial State (as in the demo above). 
Users (or your code) can unsuspend later via the Settings Panel / toolbar or the Module API.

**How do I suspend or unsuspend from code?**
Use the Module API for that object type — typically `suspendX` / `unSuspendX` (and often `suspendAll…` / `unSuspendAll…`). See the relevant Module's Technical Reference.

**Why can't I suspend Layouts or Calculated Columns?**
Those types do not implement `SuspendableObject`. 
Suspension is only available where turning an object off without removing it is a meaningful behaviour.
