Destroying Actionsheet and init'ing it again duplicates some DOM

4 posts, 0 answers
  1. Kate | D-Flo
    Kate | D-Flo avatar
    24 posts
    Member since:
    Jun 2013

    Posted 22 Sep 2014 Link to this post

    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.
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 24 Sep 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Kate | D-Flo
    Kate | D-Flo avatar
    24 posts
    Member since:
    Jun 2013

    Posted 24 Sep 2014 in reply to Petyo Link to this post

    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
  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 24 Sep 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready