javascript - How can I delete a widget in Aikau? -


i have created widget in aikau , idea inside of it, there 1 widget in moment , swaps 1 type dynamically.

my procedure follow:

  • i delete widgets inside of father widget
  • i construct new widget.

right code works, don't know if eliminating widgets children properly. didn't find function in documentation it:

swapwidget: function mypackage_mywidget__swapwidget(event) {   // remove children    // ok?   $(this.domnode).find('div').remove();    var widgetid = event.widgetid     , widget = this.widgetsposibilities[widgetid]     , clonedwidgets = lang.clone([widget])     ;   this.processwidgets(clonedwidgets, this.domnode); }, postcreate :  function mypackage_mywidget__postcreate() {   var event = {widgetid: this.initwidgetid};   this.jumpwidget(event);    this.alfsubscribe('my_custom_event', lang.hitch(this, this.swapwidget));    this.inherited(arguments); } 

it enough "$(this.domnode).find('div').remove();" eliminate children widgets?

in general prefer use jquery, maybe right way using dojo.

what best way?

what last longer in new releases of aikau?

you should try using dynamicwidgets. widget allows configure subscription topic can published on widgets model. dynamicwidgets widget automatically delete displayed widgets , render requested widgets.

i wouldn't recommend approach you're taking it's unlikely future proof. if need can provide examples of using widget, or can review examples in unit test application.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -