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

Position and SwipeToOpen Properties Doesn't effect widget

4 Answers 62 Views
Drawer
This is a migrated thread and some comments may be shown as answers.
Deniz
Top achievements
Rank 1
Veteran
Deniz asked on 16 Jul 2020, 03:09 PM

I can successfully change position and swipeToOpen properties of my widget but it doesn't change anything. Position is always left even when I initialize Position property as right. Likely, swipeToOpen is always true even it's property value is false. 

 

I change these values dynamically with the value of a checkbox like below;

->drawerInstance.options.mini =document.getElementById(widgetID+"toggle").checked;

This line of code above changes mini properties and it works perfectly. 

->drawerInstance.options.swipeToOpen =document.getElementById(widgetID+"canSwipe").checked;

On the other side, this line of code above  changes drawerInstance value properly but I can still use swipe gestures to open the drawer.

Is there are any better ways to change the values of these properties? 

4 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 20 Jul 2020, 02:12 PM

Hi, Deniz,

Thank you for the provided explanations.

For the position, I would recommend using the same approach as shown in this demo:

https://demos.telerik.com/kendo-ui/drawer/functionality

 drawerInstance.position(position);
drawerInstance.show()

However, for the swipeToOpen setting,we would need the setOptions() method which is currently not implemented for the Drawer class. Meanwhile, you can destroy and create it again if you need to change the swipeToOpen functionality.

https://docs.telerik.com/kendo-ui/intro/widget-basics/destroy

Here is a runnable example for your reference:

http://dojo.telerik.com/@bubblemaster/oZIPINoq

Let me know if you would like me log a feature request on your behalf in our feedback portal so others can upvote it. The requests in high demand get pushed forward for implementation.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

0
Deniz
Top achievements
Rank 1
Veteran
answered on 23 Jul 2020, 12:02 PM

Hi Alex,

Thank you for your answer. Your solution for position property works just perfect. However destroying and recreating widget to change swipeToOpen option is kind of complicated. How can I store all variables belongs to the drawer before destroying it and how can I pass it to the new drawer? If you could help with this one it would be great

 

Thanks in advance

0
Alex Hajigeorgieva
Telerik team
answered on 27 Jul 2020, 07:57 AM

Hello, Deniz,

You can get the options and pass them to the new instance like this:

var options = drawerInstance.options;
options.swipeToOpen = e.checked;
drawerInstance.destroy();
var elem = $("#drawer").empty();
drawerInstance = elem.kendoDrawer(options).data("kendoDrawer");

Here is an updated Dojo: http://dojo.telerik.com/UQiMilij

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

0
Deniz
Top achievements
Rank 1
Veteran
answered on 27 Jul 2020, 10:37 AM

Hi Alex,

Thank you for your time and sincere solutions,

Best.

Tags
Drawer
Asked by
Deniz
Top achievements
Rank 1
Veteran
Answers by
Alex Hajigeorgieva
Telerik team
Deniz
Top achievements
Rank 1
Veteran
Share this question
or