jQWidgets Forums

jQuery UI Widgets Forums General Discussions Destroy widget but keep div

This topic contains 1 reply, has 2 voices, and was last updated by  fewr 7 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Destroy widget but keep div #96851

    emberq
    Participant

    I’m trying to refresh a widget, for example a jqxCalendar. I’m calling destroy to remove the currently instantiated calendar widget. When I try to instantiate another jqxCalendar at the same div location it fails. Does the destroy remove the div too?

    If so what is the best way for me to achieve instantiating a new widget in place, without having to recreate the div?

    Thanks, Mike

    Destroy widget but keep div #96864

    fewr
    Participant

    Hi emberq,

    you could surround the widget with a dummy div.

    Like this:

    <body>
       <div id="CalendarDiv"></div>
    </body>
    
    function createCalendar(){
       $('#CalendarDiv').html('<div id="jqxCalendar"></div>');
       $("#jqxCalendar").jqxCalendar({...});
    }
    
    function destroyCalendar(){
       $('#jqxCalendar').jqxCalendar('destroy'); 
    }
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.