How to reset the scroll position in a Kendo Drodown on some action.

1 Answer 14 Views
DropDownTree
Joe
Top achievements
Rank 1
Joe asked on 21 Mar 2024, 08:43 AM | edited on 21 Mar 2024, 08:55 AM

My requirement is similar to this question "How to reset the scroll position in a Kendo Dialog (jquery) in Kendo UI for jQuery | Telerik Forums"Reset Scroll Position in Kendo Dialog jQuery

My only requirement is to reset the scroll position of the dropdown whenever a button is clicked. Currently, when I reopen the dropdown, it remembers the last scroll position. I want this position to be reset whenever the user performs an action, such as clicking a button.

1 Answer, 1 is accepted

Sort by
1
Accepted
Neli
Telerik team
answered on 26 Mar 2024, 06:46 AM

Hi,

You can handle the open event of the DropDownTree:

- https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdowntree/events/open

In the event handler you can use a slight delay and the scrollTop as demonstrated below: 

open: function(e){
            setTimeout(function(){             
                  $(".k-treeview").scrollTop(0)
            })
},

Here you will find a Dojo example - https://dojo.telerik.com/@NeliK/uNEraWoS

Regards,
Neli
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
Joe
Top achievements
Rank 1
commented on 26 Mar 2024, 10:13 AM

Hey thanks Neli,

setTimeout() indeed does the trick. :)

Thanks!
Tags
DropDownTree
Asked by
Joe
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or