updateMessage
Updates an existing message with new data.
Parameters
message Object
The message object to update.
newData Object
The new data to apply to the message.
Returns
Object
- The updated message object.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This message will be updated after 3 seconds.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "Watch the first message change its text content!",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
}
];
let chat = $("#chat").kendoChat({
authorId: "user1",
dataSource: messagesData
}).data("kendoChat");
// Update the first message after 3 seconds
setTimeout(function() {
let messageObject = chat.dataSource.get(1); // Get message with id 1
if (messageObject) {
let updatedMessage = chat.updateMessage(messageObject, {
text: "✅ This message has been updated successfully!"
});
console.log("Message updated:", updatedMessage.text);
}
}, 3000);
</script>
In this article