Page 1 of 1
[SOLVED]delete Action Button.
Posted: 07 September 2015, 22:07
by Rudolf
Hello.
When I create a button like that:
Code: Select all
this.addActionButton( 'button_'+$subloc, _('ATTACK '+$subloc), 'onSENButton');
what is the name of the function that delete this Button?
thanks.
Rudolf
Re: delete Action Button.
Posted: 08 September 2015, 02:56
by pikiou
Just delete the element it created. Its ID is 'button_'+$subloc
Re: delete Action Button.
Posted: 08 September 2015, 19:11
by Rudolf
Ok...
Here is code running:
Code: Select all
addSENAttack: function($subloc){
this.addActionButton( 'button_'+$subloc, _('ATTACK '+$subloc), 'onSENButton');
},
delSENAttack: function($subloc){
var elem = document.getElementById('button_'+$subloc);
elem.parentNode.removeChild(elem);
},
Re: delete Action Button.
Posted: 13 September 2015, 00:15
by Rudolf
Thanks Pikiou.
Re: [SOLVED]delete Action Button.
Posted: 14 September 2015, 08:57
by Quinarbre
Why not
Code: Select all
dojo.destroy($('button_'+$subloc));
?
Re: [SOLVED]delete Action Button.
Posted: 14 September 2015, 16:15
by Rudolf
because did not know this

Which one is better?
I was wondering if connections were destroyed also... and it seems to be done with removechild.... is it the case with dojo.destroy?
Re: [SOLVED]delete Action Button.
Posted: 14 September 2015, 20:31
by Quinarbre
I don't know for sure what dojo functions actually do, but I'm sure they cover much more than what I could imagine if I had to write similar functions myself
