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

DatePicker span elements hanging around after destroy

3 Answers 373 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 14 May 2018, 06:29 PM
I'm not sure if this is expected behavior, but when you destroy a KendoDatePicker, the spans that Kendo creates on initialization of the widget stick around afterwards.  It seems like something that Kendo should be cleaning up when it destroys a widget, since they are Kendo specific elements it added to the DOM.

Dojo to reproduce:
https://dojo.telerik.com/OBImobad

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 May 2018, 06:31 AM
Hello, Ryan,

Thank you for the example.

The spans are still on the page as the widget that has wrapper elements as the DatePicker, instead of removing the initial DOM element used to create the widget, the wrapper has to be removed:

https://dojo.telerik.com/OBImobad/2

As the wrappers have a more generic class selector, if there are more elements,  and only one has to be removed, the selector has to be made more specific.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Ryan
Top achievements
Rank 1
answered on 15 May 2018, 03:16 PM
Hi Stefan,
That's where my question stemmed from though, shouldn't all those extra elements attached to the DOM by Kendo be removed from the DOM by Kendo as well, on destroy?

To me, it seems like that is a Kendo responsibility and not the end-user
0
Stefan
Telerik team
answered on 16 May 2018, 05:53 AM
Hello, Ryan,

Thank you for the feedback.

In general, the destroy method has a function to destroy the bindings and the different attached event listeners. This is the reason is our destroy article we advised the removing of the DOM elements has to be done programmatically by the developer:

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

We do not remove the DOM automatically, as in some cases the developer may want to reuse the same DOM element. Removing it and then adding it again could create unnecessary DOM operations which can slow the application.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Date/Time Pickers
Asked by
Ryan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or