# Notes Technical Reference

Canonical page: https://www.adaptabletools.com/docs/technical-reference-notes

## Note State

| Property | Type | Description |
| --- | --- | --- |
| [Notes](https://www.adaptabletools.com/docs/reference/notestate.md#notes) | [`AdaptableNotes`](https://www.adaptabletools.com/docs/reference/adaptablenotes.md) | Notes to show. One note occupies one cell. |

### Adaptable Note 

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [Author](https://www.adaptabletools.com/docs/reference/adaptablenote.md#author) | `string` | Author of the Note - uses AdaptableOptions.userName when Note is created |   |
| [ColumnId](https://www.adaptabletools.com/docs/reference/adaptablenote.md#columnid) | `string` | Id of Column containing the Note |   |
| [CreatedAt](https://www.adaptabletools.com/docs/reference/adaptablenote.md#createdat) | `number` | When the Note was first created; maps to AG Grid&#39;s Note.createdAt |   |
| [NoteType](https://www.adaptabletools.com/docs/reference/adaptablenote.md#notetype) | [`AdaptableMessageType`](https://www.adaptabletools.com/docs/reference/adaptablemessagetype.md) | Type of Note - `'Info' \| 'Warning' \| 'Error' \| 'Success'`; drives colour of Cell Note indicator | &#39;Info&#39; |
| [PrimaryKeyValue](https://www.adaptabletools.com/docs/reference/adaptablenote.md#primarykeyvalue) | `any` | Value in Grid&#39;s Primary Key Column |   |
| [Text](https://www.adaptabletools.com/docs/reference/adaptablenote.md#text) | `string` | Content of the Note |   |
| [UpdatedAt](https://www.adaptabletools.com/docs/reference/adaptablenote.md#updatedat) | `number` | When the Note was last updated; maps to AG Grid&#39;s Note.updatedAt |   |
| [IsReadOnly](https://www.adaptabletools.com/docs/reference/adaptablenote.md#isreadonly) | `boolean` | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of &#39;Full&#39;) |   |

`NoteType` is an AdapTable message type: `Success`, `Info`, `Warning`, or `Error`.

-------------

## Note Options

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [dateFormat](https://www.adaptabletools.com/docs/reference/noteoptions.md#dateformat) | `string \| (() => string)` | Date Format string for Notes timestamp | &#39;dd-MM-yyyy HH:mm:ss&#39; |
| [defaultNoteType](https://www.adaptabletools.com/docs/reference/noteoptions.md#defaultnotetype) | [`AdaptableMessageType`](https://www.adaptabletools.com/docs/reference/adaptablemessagetype.md) | Type given to a Note on creation (`'Info' \| 'Warning' \| 'Error' \| 'Success'`) | &#39;Info&#39; |
| [isCellNotable](https://www.adaptabletools.com/docs/reference/noteoptions.md#iscellnotable) | `(context: `[`NotableCellContext`](https://www.adaptabletools.com/docs/reference/notablecellcontext.md)`) => boolean` | Whether a cell can contain Notes |   |

`defaultNoteType` is the same message type: `Success`, `Info`, `Warning`, or `Error`.

`isCellNotable` receives a [`NotableCellContext`](https://www.adaptabletools.com/docs/reference/notablecellcontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [gridCell](https://www.adaptabletools.com/docs/reference/notablecellcontext.md#gridcell) | [`GridCell`](https://www.adaptabletools.com/docs/reference/gridcell.md) | Grid Cell in AdapTable which has been clicked |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/notablecellcontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

When a Note opens (hover vs click) is an AG Grid `GridOptions` setting — `noteTrigger`, plus optional `noteShowDelay` / `noteHideDelay`. See [Opening Notes](https://www.adaptabletools.com/docs/handbook-notes-configuring/index.md).

-------------

## Note API

| Method | Returns | Description |
| --- | --- | --- |
| [addNote(text, primaryKeyValue, columnId, extra)](https://www.adaptabletools.com/docs/reference/noteapi.md#addnote) | `void` | Adds a new Note |
| [deleteNote(note)](https://www.adaptabletools.com/docs/reference/noteapi.md#deletenote) | `void` | Removes a note from state. |
| [editNote(note)](https://www.adaptabletools.com/docs/reference/noteapi.md#editnote) | `void` | Replaces a note already in state. |
| [getAllNotes()](https://www.adaptabletools.com/docs/reference/noteapi.md#getallnotes) | [`AdaptableNotes`](https://www.adaptabletools.com/docs/reference/adaptablenotes.md) | Gets all Notes |
| [getNoteByUuid(uuid)](https://www.adaptabletools.com/docs/reference/noteapi.md#getnotebyuuid) | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md)` \| undefined` | Returns a Note by uuid |
| [getNoteForCell(cellAddress)](https://www.adaptabletools.com/docs/reference/noteapi.md#getnoteforcell) | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Gets all Notes for a cell |
| [getNoteState()](https://www.adaptabletools.com/docs/reference/noteapi.md#getnotestate) | [`NoteState`](https://www.adaptabletools.com/docs/reference/notestate.md) | Gets the Note State |
| [setNoteType(note, noteType)](https://www.adaptabletools.com/docs/reference/noteapi.md#setnotetype) | `void` | Sets Type of a Note (`'Info' \| 'Warning' \| 'Error' \| 'Success'`), which drives colour of Note indicator |
| [updateNoteText(text, note)](https://www.adaptabletools.com/docs/reference/noteapi.md#updatenotetext) | `void` | Replaces the text of a note. |

-------------

## Note Changed Event

The Note Changed Event fires whenever Note State changes — including edits made in AG Grid's Note editor, the Notes Settings Panel, and Note API calls.

### NoteChangedInfo

The event comprises a single [`NoteChangedInfo`](https://www.adaptabletools.com/docs/reference/notechangedinfo.md) object which contains details about what action triggered the change and the associated Note.

| Property | Type | Description |
| --- | --- | --- |
| [actionName](https://www.adaptabletools.com/docs/reference/notechangedinfo.md#actionname) | [`NoteChangedAction`](https://www.adaptabletools.com/docs/reference/notechangedaction.md) | What caused Note State to change (i.e. Added, Edited, Deleted) |
| [note](https://www.adaptabletools.com/docs/reference/notechangedinfo.md#note) | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Note that has been added, edited or deleted |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/notechangedinfo.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

### Action Names

The value for the `actionName` property can be one of:

- `Added`
- `Edited`
- `Deleted`

### Event Subscription

Subscribing to the Event is done the same way as with all [Adaptable Events](https://www.adaptabletools.com/docs/technical-reference-adaptable-events/index.md):

```ts
api.eventApi.on('NoteChanged', (eventInfo: NoteChangedInfo) => {
    // do something with the info
});
```
