This is a migrated thread and some comments may be shown as answers.

Move to end of list

1 Answer 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 14 Apr 2014, 01:07 AM
Dear Sirs,

I am building an application that will allow IM communication between providers and patients.  I am using the following template to show the message:

</script>
<script id="messageTemplate" type="text/x-kendo-template">
                <div class="post-content">
                    <p>Date Of Message: #= date_time_created_to_string#</p>                    
                    <p>To: #= messageReceiverName#</p>
                    <p>From: #= messageSenderName#</p>
                    <p>Message:</p>                    
                    <p>#=message#</p>
                </div>
            <br>
 </script>  

I am using the following code to bind the template to a datasource and add when a new message is added to the data source.  The code is working as expected.  What I would like to happen is when a new message is added is there a way to scroll to that message so that the user does not have to?

        var template = kendo.template($("#messageTemplate").html());
        //var dataSource = new kendo.data.DataSource({data: category});
        messageDataSource = new kendo.data.DataSource({data: theMessages});                        

        messageDataSource.bind("change", function() {
        $("#example").html(kendo.render(template, messageDataSource.view()));
        });

Scott

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 Apr 2014, 11:48 AM
Hello Scott,

The functionality that you are looking for is not supported out of the box with Kendo UI. However you can achieve this pretty easily using jQuery scrollTo() method and some simple calculations. Please check the following example that I created and let me know if it helps:

http://jsbin.com/malus/1/edit

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Scott
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or