Skip to main content

addComment()

Description

Inserts a new comment into the specified card using its ID

Usage

addComment({
id?: string | number,
cardId: string | number,
comment: {
text?: string,
date?: Date,
html?: string
}
}): void;

Parameters

  • id - (optional) identifier for the new comment
  • cardId - (required) identifier of the card where the comment will be added
  • comment - (required) object defining the new comment's details. It can include:
    • text - (optional) the comment's text content
    • date - (optional) the date associated with the comment
    • html - (optional) HTML content for the comment. To display HTML instead of plain text, enable the html property in the editorShape configuration

Example

// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards
});
// add new comment
board.addComment({
id: 1,
cardId: 1,
comment: {
text: "",
date: new Date("01/07/2021"),
html: "<b>Important comment</b>"
}
});

Change log: This method was introduced in version 1.4