scrolling ListView

1 Answer 53 Views
ListView
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
Jacek asked on 17 Apr 2023, 11:46 PM

Hi,

How can I use JS to scroll the ListView to the bottom.
The solution below does not work
            var listView = $("#ChatListView").data("kendoListView");
            var lastIndex = listView.dataSource.total() - 1;
            var lastItemOffsetTop = listView.items().eq(lastIndex).offset().top;
            var listViewHeight = listView.element.height();
            var scrollDistance = lastItemOffsetTop - listViewHeight + listView.items().eq(lastIndex).height();
            listView.element.scrollTop(scrollDistance);

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 20 Apr 2023, 02:34 PM

Hi Jacek,

Thank you for reaching out. At first glance, indeed you are on the right track. After further investigation, I did not see anything apparent that could potentially disrupt the scrolling process of the ListView.

I tried reproducing the behavior within an isolated environment but to no avail:

While producing the following result:

I may be missing something pivotal, so any potential pointers or details regarding the ListView configuration would be greatly appreciated. In addition, would it be possible for you to consider reciprocating the behavior within the attached sample and send it back for further examination?

I look forward to hearing back from you.

Kind Regards,
Alexander
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.

Tags
ListView
Asked by
Jacek
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Alexander
Telerik team
Share this question
or