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

Destroying Actionsheet and init'ing it again duplicates some DOM

3 Answers 68 Views
ActionSheet
This is a migrated thread and some comments may be shown as answers.
Kate | D-Flo
Top achievements
Rank 1
Kate | D-Flo asked on 22 Sep 2014, 03:51 PM
Hello there,

I'm using version 2014.1.318

I've got a web application where the content and widgets are loaded dynamically via ajax, so I need to be able to tidy the DOM as I go along.

I'm using Actionsheet as a menu for the KendoGrid table rows. When I unload my page, I call destroy methods on both KendoGrid and Actionsheet. However, if I destroy the Actionsheet, and init it again, the number of "Cancel" list items grows each time. Please see attachment.

I've been trying to replicate this error on your Dojo, however after destroying both the Grid and the Actionsheet, the grid doesn't initialise again...
http://dojo.telerik.com/OPAx

I did see that the destroy() method for Acitonsheet doesn't touch DOM - but shouldn't it at least remove the DOM elements that were created as part of initialisation? Otherwise, there'll be endlessly growing DOM!

Your advice appreciated, many thanks.

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 24 Sep 2014, 08:45 AM
Hi Kate,

The behavior you describe was changed in our recent releases, this is why you see a difference in the dojo. When the ActionSheet is initialized, it re-attaches its contents in a popup in the body element. Destroying the widget removes the popup (and its contents) - this may be observed in this simplified version of your example. This means that after the ActionSheet is destroyed, the original element is lost and can't be reused for another initialization. 

My guess is that, since you are going to reload the contents with Ajax, the current behavior should work for you. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kate | D-Flo
Top achievements
Rank 1
answered on 24 Sep 2014, 09:45 AM
Hi Petyo,

The reason that I'm raising the ticket is because the behaviour doesn't work :) When I call the destructor, the popup is removed, as desired. But when I initiate the widget again, this additional popup element is created again (correct) but there is now a duplicated Cancel list item (bug?). Every time I destroy and re-create, there are one more Cancel list items, as can be seen on my attachment above.

Currently it looks like I'll have to check the DOM myself after the Actionsheet initialisation and strip out the duplicates.

Do you know if this bug is definitely fixed in the later versions? We simply don't have time at the moment to upgrade & re-test everything in case there are compatibility issues - unless this bug has definitely been fixed...

Many thanks,
Kate
0
Petyo
Telerik team
answered on 24 Sep 2014, 10:32 AM
Hello Kate,

Please check an updated version of the example where the ActionSheet is re-created each time. As far as I can see, the cancel button is not duplicated.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ActionSheet
Asked by
Kate | D-Flo
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Kate | D-Flo
Top achievements
Rank 1
Share this question
or