How do I change the class of the submit buttons in the main editor modal?

How do I change the class of the submit buttons in the main editor modal?

bsukbsuk Posts: 92Questions: 26Answers: 2
edited April 2016 in Free community support

Hopefully this is a simple one, but I've searched everywhere and can't find this..
I just want to change the button class of my bootstrap "create" button to "btn btn-success" instead of it's default "btn btn-default"
I tried in the i18n section but it doesn't seem to work..

It's easy with the actual datatable buttons as they are called in the datatable code, but I can't see how to customise the editor modal ones.

Many thanks.

Answers

  • tombeuckelaeretombeuckelaere Posts: 2Questions: 1Answers: 0

    I wish to do the same, is there a solution?

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin

    Hi,

    If you are using the create button (etc) you can use formButtons option of that button type to define the buttons you want to display. For example:

    $('#myTable').DataTable( {
        buttons: [
            {
                extend: 'create',
                editor: myEditor,
                formButtons: {
                    label: 'Save',
                    fn: function () { this.submit(); },
                    className: 'btn btn-default'
                }
            }
        ]
    } );
    

    The formButtons object it passed into buttons() which defaults what values it can take. It appears the fact that you can set a className parameter is missing from that documentation at the moment - sorry! I'll correct that forthwith!

    Regards,
    Allan

  • bsukbsuk Posts: 92Questions: 26Answers: 2

    Thanks Allan, but that doesn't seem to be working.
    I just get the standard "confirm" button when I apply that code.
    Are there any additional steps that I could be missing?

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin

    Hi,

    Did you update the className to be btn btn-success? Also, if you right click on the button and select "Inspect" does it show the class or not?

    If it isn't there, could you show me your full Editor code, or give me a link to the page please?

    Thanks,
    Allan

This discussion has been closed.