javascriptjqueryasp.net-mvckendo-uikendo-listview

How to scroll to bottom of kendo list view control


I am building an application where I need to show the most recent item to the bottom of the kendo listview control and therefore the scroll should be at the bottom position.

I tried the following ways but was not able to achieve the desired result.

listView.select(listView.element.children().last());

var lastElement = $(".container").last(); $(this.messageListId).animate({ scrollTop: lastElement.scrollTop() }, 1000);

On the data source of the kendolist view is set the scrollbar should be set to bottom


Solution

  • let listView = $('#id').data("kendoListView");
    var children = listView.element.children();
    if (children.length > 0) {
      children.last().get(0).scrollIntoView(true);
    }