How to clear RadChat Messages?

1 Answer 213 Views
Chat
Randy
Top achievements
Rank 1
Iron
Randy asked on 24 Aug 2021, 07:48 AM

How to clear RadChat Messages in javascript? I tried clear and it didnt work

<telerik:RadChat runat="server" ID="RadChat1" Height="400px">
                <MessagesSettings Placeholder="Enter message here" />
</telerik:RadChat>

 

var radChat = $find("<%=RadChat1.ClientID %>");
radChat.clear()

 

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Rumen
Telerik team
answered on 24 Aug 2021, 02:53 PM

Hi Amendra,

If you would want to clear the content of the chat, you can utilize jQuery and get access to the element that holds the messages and clear the messages.

<telerik:RadButton runat="server" ID="RadButton1" Text="Clear Chat Screen" AutoPostBack="false" OnClientClicked="clearChatScreen" />

<script>
    function clearChatScreen(sender, args) {
        $('.RadChat .t-message-list-content div').remove();
    }
</script>


For more information on available Client-Side APIs you can check out the RadChat documentation at RadChat Object. Since this component is a wrapper for the Kendo Chat widget, some APIs can only be accessed for the underlying kendo Widget. For a full list of API configurations visit the kendo.ui.Chat documentation.

Regards,
Rumen
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Randy
Top achievements
Rank 1
Iron
commented on 24 Aug 2021, 07:45 PM

Thanks for the answer Rumen.. 
Tags
Chat
Asked by
Randy
Top achievements
Rank 1
Iron
Answers by
Rumen
Telerik team
Share this question
or