Chnage custom button style

Chnage custom button style

klinglerklingler Posts: 90Questions: 42Answers: 2

Good afternoon (o;

For shop backend project I place a few custom buttons beside the new/edit/delete buttons to toggle the loaded ajax....didn't find anything related for placing checkboxes side by side to the regular buttons...

Adding a custom class to the button shows no effect as in:

{ text: 'All', className: 'buttons button-active' }

Where "button-active is my own class coloring it with a blue background....

So far I came up with something like this when the button is pressed:

        { text: 'All', className: 'buttons button-active', action: function( e, dt, node, config ) {
                node[0].style.backgroundColor = "blue";
                node[0].style.color = "white";
            }
        },

But of course this gets only triggered when pressed...is there a button API call which is run when the buttons are initialized?

thanks in advance
richard

Answers

  • klinglerklingler Posts: 90Questions: 42Answers: 2

    Okay...found it...easy peasy (o;

        initComplete: function() {
            console.log("Init complete...");
            selection = 0;
            var node = $(".button-1");
            node[0].style.backgroundColor = "#bb003d";
            node[0].style.color = "white";
        },
    
  • allanallan Posts: 61,446Questions: 1Answers: 10,055 Site admin

    Thanks for the update - good to hear you found a solution.

    For something a bit more modular, the buttons.buttons.init option for the button definition is probably a better way to do it.

    Allan

Sign In or Register to comment.