[SOLVED]delete Action Button.

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

[SOLVED]delete Action Button.

Post 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
Last edited by Rudolf on 13 September 2015, 00:15, edited 1 time in total.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: delete Action Button.

Post by pikiou »

Just delete the element it created. Its ID is 'button_'+$subloc
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: delete Action Button.

Post 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);
        },
        
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: delete Action Button.

Post by Rudolf »

Thanks Pikiou.
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: [SOLVED]delete Action Button.

Post by Quinarbre »

Why not

Code: Select all

dojo.destroy($('button_'+$subloc));
?
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: [SOLVED]delete Action Button.

Post 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?
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: [SOLVED]delete Action Button.

Post 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 :lol:
Post Reply

Return to “Developers”