Comments Technical Reference
Summary
- Comment Options allows developers to configure which Cells can receive Comments
- Comment API provides run time access to Comments
Comment State
There is no Comment State due to the collaborative nature of comments.
Instead Comment Threads are stored using the functions provided in Comment Options.
Comment Options
The Comment Options section of Adaptable Options contains properties used to configure Comments:
| Property | Description | Default |
|---|---|---|
| dateFormat | Date Format string for Comments timestamp | 'dd-MM-yyyy HH:mm:ss' |
| isCellCommentable | Function to configure if a cell can contain Comments | |
| showPopupCloseButton | Show the Close Button in the Comments Popup | true |
Loading and Saving Comments
Comment Options contains 2 functions which developers must provide in order to load and save Comments:
| Method | Description |
|---|---|
| loadCommentThreads(commentLoadContext) | Loads the Comment Threads |
| persistCommentThreads(commentThreads) | Persists the current Comment Threads |
Comment Changed Event
The Comment Changed Event fires whenever a Comment changes.
CommentChangedInfo
The event comprises a single CommentChangeInfo object which provides all the current Comment Threads.
| Property | Description |
|---|---|
| commentThreads | All current Comment Threads |
| adaptableContext | 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
});Comment API
Full programmatic access to Comments is available in Comment API section of Adaptable API.
| Method | Description |
|---|---|
| addComment(commentText, cellAddress) | Add a Comment to a Comment Thread |
| addCommentThread(commentThread) | Create a new Comment Thread |
| clearComments() | Clear all Comment Threads in the grid |
| deleteComment(comment, cellAddress) | Delete a Comment |
| deleteCommentThread(cellAddress) | Delete all Comments for a particular cell |
| editComment(comment, cellAddress) | Edit a Comment |
| getAllComments() | Return all Comment Threads in the grid |
| getCommentThreadForCell(cellAddress) | Return the Comment Thread for a particular cell |
| hideCommentsPopup() | Close the Comment Popup |
| setComments(commentThreads) | Sets the Comment Threads in the grid |