2

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?

Vladimir Georgiev
  • 1,949
  • 23
  • 26
hpet
  • 299
  • 2
  • 14

1 Answers1

1

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

Vladimir Georgiev
  • 1,949
  • 23
  • 26
Yavor Angelov
  • 521
  • 2
  • 5
  • Thanks guys. I think I have some basic idea how it works. I will set up a test project to see how it handles. In all demos I see that basic html elements are already declared up front. Is this a preferred way of setting up a layout or such, or it makes no difference if elements are dynamically created from code during execution when required? – hpet Nov 21 '16 at 15:08
  • It should not make any difference, as long as you initialize the Shield UI widget after the HTML element has been added to the DOM. – Vladimir Georgiev Nov 22 '16 at 07:29