Comments Technical Reference
Comment State
CommentState
Comment threads for the current session.
This section is not persisted and is not part of Initial State. Load threads with commentOptions.loadCommentThreads and save them with commentOptions.persistCommentThreads.
Comment threads for this session. Each thread belongs to one cell (PrimaryKeyValue and ColumnId) and holds its Comments in order.
CommentThread
CommentThread
Every comment on one cell.
The cell is PrimaryKeyValue plus ColumnId (from CellAddress). Comments is the thread, in order.
TypeUuid
Unique identifier for Comment
Adaptable Comment
AdaptableComment
One comment in a cell's thread.
Value is the text. Timestamp is when it was written. Author.UserName is who wrote it. Uuid identifies the comment.
string
Id of this AdapTable instance
number
When Comment was made
TypeUuid
Unique identifier for the Comment
string
Content of the Comment
Comment Options
CommentOptions
Comments on cells. A thread is the list of comments for one cell.
Comments are not stored in AdapTable State. The application loads them with and saves them with .
string | (() => string)
Date Format string for Comments timestamp
'dd-MM-yyyy HH:mm:ss'
(commentableCellContext:CommentableCellContext) => boolean
Function to configure if a cell can contain Comments
'hover' | 'menu'
Whether to show Comments by hovering (default) or via context menu
'hover'
isCellCommentable receives a CommentableCellContext:
CommentableCellContext
Context used when determining if a cell can show Comments
Custom application Context provided in AdaptableOptions.adaptableContext
Loading and Saving Comments
Comment Options contains 2 functions which developers must provide in order to load and save Comments:
CommentOptions
Comments on cells. A thread is the list of comments for one cell.
Comments are not stored in AdapTable State. The application loads them with and saves them with .
Promise<CommentThread[]>
Loads every comment thread when the grid starts.
Promise<void>
Saves the threads after a comment is added, edited or deleted.
Called with the full set, not only the thread that changed.
Comment API
CommentApi
Comments on cells. A thread holds the comments for one cell.
void
Add a Comment to a Comment Thread
void
Create a new Comment Thread
void
Clear all Comment Threads in the grid
void
Delete a Comment
void
Delete all Comments for a particular cell
void
Edit a Comment
Return all Comment Threads in the grid
CommentThread | undefined
Return the Comment Thread for a particular cell
void
Close the Comment Popup
void
Sets the Comment Threads in the grid
Comment Changed Event
The Comment Changed Event fires whenever a Comment changes.
CommentChangedInfo
The event comprises a single CommentChangedInfo object which provides all the current Comment Threads.
CommentChangedInfo
Payload of the CommentChanged event.
Fires when a comment or comment thread is added, edited or deleted. Loading threads does not fire it.
Extends , so adaptableApi is included.
Every comment thread after the change.
This is the full list commentApi.getAllComments() returns, not only the thread that changed.
Custom application Context provided in AdaptableOptions.adaptableContext
Event Subscription
Subscribing to the Event is done the same way as with all Adaptable Events:
api.eventApi.on('CommentChanged', (eventInfo: CommentChangedInfo) => {
// do something with the info
});
AdaptableComment[]Collection of Comments for this Cell