Does the renderUserTypingIndicator method not have any effect during the onPost event?

1 Answer 77 Views
Chat
Alan
Top achievements
Rank 1
Alan asked on 12 Jul 2023, 01:36 PM
Hi,

When I use the chat widget to send a message, it triggers the post event. I hope to display the User Typing Indicator using the renderUserTypingIndicator method within the onPost function, but it seems to have no effect? However, testing the renderUserTypingIndicator within $(document).ready seems to work. Have I misunderstood the usage method?

 

<div id="chat"></div>
<script>

    $(document).ready(function () {

        var chat = $("#chat").kendoChat({
            post: onPost
        }).data("kendoChat");

        chat.renderMessage({
            type: "text",
            text: "Hello, how can I assist you today?",
            timestamp: new Date()
        }, {
            name: "Chatbot"
        });


        function onPost(args) {
            var chatargs = args.sender;
            var chat = $("#chat").data("kendoChat");

            // Render the typing indicator.
            chat.renderUserTypingIndicator({ name: "Chatbot" });

        }

    });

</script>

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 17 Jul 2023, 11:50 AM

Hello, Alan,

The renderMessage method does not trigger the post event, so you will need to fire the event manually.

chat.trigger("post")

Here is a small Dojo example for reference.

Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Alan
Top achievements
Rank 1
commented on 19 Jul 2023, 11:10 AM

my requirement is trigger renderUserTypingIndicator() after user post and remove Typing Indicator() on back-end server response answer througe ajax request. is that possible?

Martin
Telerik team
commented on 24 Jul 2023, 10:40 AM

Hi, Alan,

You can display the typing indicator through a setTimeout function in the post event. In the post event you can also initiate the AJAX request to the server to proceed with the rest of the requirement - https://dojo.telerik.com/OVAwoMuN/10 

Tags
Chat
Asked by
Alan
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or