hpet hpet - 1 year ago 75
jQuery Question

creating and destroying shieldUI widgets

I am coming from a different development background with a very little jQuery and/or shieldUI knowledge. Can someone please very shortly explain how to remove/destroy shieldUI components or widgets? I don't see any special widget method therefore I assume this is done with jQuery. By destroying I mean removing everything down to (including) markup.

Also, what happenes with widget when calling hide()? I see that markup is somehow stripped down (removed), but some wrappers remain. Is it safe to call another widget setup with the same "id" ? will it overwrite? will it cause object orhpans?

As you see I am missing some very basic "how it works". I am a quick learner so please, just few basic pointers will do. Thank you :)

EDIT: found destroy widget method under "swidget()"...what is swidget?

Answer Source

swidget() gives you a reference to the component instance, through which you can access methods and properties, such as height, width, refresh(), destroy(), etc.

Further, with respect to the question at hand, regarding the destroy method and approach - the ideas is, that whenever you need to refresh some data on the component, you can recreate it, rather than calling a method such as rebind. This is demonstrated in the following demo: http://demos.shieldui.com/web/rangebar-chart/related-charts

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download