Nicer create button

Nicer create button

nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
edited November 2012 in Editor
Hi,

How can I style the title of the modal, and the create button (it should say "Save" and be styled with specific bootstrap classes)?

Thanks,

Nathan

CURRENT CODE

"oTableTools": {
//"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor_faqCategories }
]
},

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    [code]
    {
    "sExtends": "editor_create",
    "editor": editor_faqCategories
    "sButtonClass": "... classes ...",
    "sButtonText": "Save"
    }
    [/code]

    The full list of TableTool button options are available here: http://datatables.net/extras/tabletools/button_options

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Thanks, but what I meant was the buttons that show *AFTER* you create the button to click record.

    So the buttons in the "create new record" modal for the EDITOR.

    E.g.

    editor_faqCategories.buttons( [
    {
    "label": "Cancel",
    "className":"btn btn-link",
    "fn": function () {
    editor_faqCategories.close();
    }
    },
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Oh I see. It looks like you've already got it all have you not? Both the label and class are set there.

    If you don't want to pass button defs into the API methods you can alter the buttons which the default TableTools buttons defined by Editor put in by using `TableTools.BUTTONS.editor_create` . That's just a button object like that which is passed into the API methods.

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Could you show me a code sample of how I would initiate this? Merci.
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    [code]
    TableTools.BUTTONS.editor_create.formButtons = [
    { "label": null, "fn": function (e) { this.submit(); } }
    ];
    [/code]

    is the default button for the create button, so you'd add className onto that:

    [code]
    TableTools.BUTTONS.editor_create.formButtons[0].className = "btn btn-link";
    [/code]

    for example.

    Allan
This discussion has been closed.