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

DropDownList prevent close on scroll, anytime

1 Answer 762 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Bertrand
Top achievements
Rank 1
Bertrand asked on 16 Oct 2015, 11:59 AM

I would like to know if the behavior explained here can be added automatically to every DropDownList created dynamically in my application: 

http://docs.telerik.com/kendo-ui/web/dropdownlist/how-to/prevent-close-on-scroll

I would like this to be the default behavior for all my DropDownList because otherwise I consider they are not working as expected (same as a regular Select element, which does not close when scrolled). Thanks.

1 Answer, 1 is accepted

Sort by
0
Plamen Lazarov
Telerik team
answered on 20 Oct 2015, 10:09 AM

Hello Bertrand,

By design, the DropDownList popup closes when any of the parent elements are scrolled. When the last popup item is reached widget does not prevent the default browser behavior. Hence the parent is scrolled and widget's popup is closed automatically.

I am afraid that preventing the popup close while scrolling cannot be added to the DropDownList as a built-in behavior, as the available technical solution is not 100% stable. For the time being, it should be implemented by the developer manually. He/she needs to ensure that the applied change will work as expected in the browser that the app needs to support.

Regards,
Plamen Lazarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Johan Lindqvist
Top achievements
Rank 1
commented on 06 Sep 2021, 07:43 AM

Hi,

Have you changed your plans in relation to the dropdownlist being closed when a parent element is closed? We think this would definitely improve the user experience.


Thanks in advance.

Neli
Telerik team
commented on 08 Sep 2021, 06:08 AM

Hi Johan,

The behavior has not been changed. The DropDownList still closes when any of its parents is scrolled. 

Another possible approach to prevent the DropDownList from closing is to handle the scroll event of the window, set a global variable, and get a reference to the popup widget used by the DropDownList in its open event:

open:function(e){
            var popup = $(e.sender.list).getKendoPopup()
            popup.bind("close", function(e) {
              if (scroll) {
                e.preventDefault(); //prevent popup closing                    
              }
            });
          }

Here is a Dojo example where this is demonstrated. 

 I hope this helps.

Regards,

Neli

Tags
DropDownList
Asked by
Bertrand
Top achievements
Rank 1
Answers by
Plamen Lazarov
Telerik team
Share this question
or