Hypnos
Hypnos

Reputation: 285

How can I change Slickgrid editor button css class (or any dynamically created button)?

I am trying to change the editor button (save, cancel) css in Slickgrid. How do I apply a css class to the button item as shown below?

<body>
    <div><button>save</button></div>
</body>

I tried to bind the cell double click event to this code:

$("body button").addClass("custom_button");

It was not working because:

  1. the event is called before the button is rendered
  2. all other < div >< button > items are affected.

Thanks in advance!


EDIT:

  1. I can't use tag but class for css styling for some reason.
  2. If you have not used slickgrid before, this button only appears after you double click grid cell.

Upvotes: 0

Views: 531

Answers (3)

Hypnos
Hypnos

Reputation: 285

just modify slickgrid.editor.js and apply the class.

Upvotes: 0

clav
clav

Reputation: 4251

If you want to style all buttons in the body, you can just use CSS. Put the style from your custom_button class in a CSS selector, put something like this in the head of your page:

<style type="text/css">
    body button {
        /* styles from custom_button class go here */
    }
</style>

Upvotes: 0

OliverK
OliverK

Reputation: 156

Give the button an id.

<button id="saveButton">save</button>

That way you can call it directly

$("saveButton").addClass("custom_button");

Upvotes: 0

Related Questions