How to add button in Standalone collection editor?

How to add button in Standalone collection editor?

MarekAdamMarekAdam Posts: 30Questions: 9Answers: 1

Link to test case:
Description of problem: I need to add 2 buttons in this place
One for reseting data in the form (erase all) and second for ajax query that will send an email (so i have to post form_id).

I have no idea how to do it in the table from the linked test case.
I was thinking to add template: '#customForm' but dont know where
Any ideas?


  • kthorngrenkthorngren Posts: 20,584Questions: 26Answers: 4,823

    See if this thread and this example help add buttons to the Editor form.


  • MarekAdamMarekAdam Posts: 30Questions: 9Answers: 1

    Thanks for fast answer :) Unfortunately, I tested the example you linked earlier and it does not work in this case (Standalone collection editor).
    My code is:

    // Load the initial data and display in panels
                url: '/php/z.php',
                dataType: 'json',
                buttons: [
                    { extend: 'create', editor: editor_e },
                        extend: 'selected',
                        text: 'Edit',
                        action: function () {
                            let indexes = table.rows({ selected: true }).indexes();
                            editor_e.edit(indexes, {
                                title: 'Edit',
                                buttons: indexes.length === 1 ? backNext : 'Save'
                    { extend: 'remove', editor: editor_e }
                success: function (json) {
                    for (var i = 0, ien =; i < ien; i++) {
            $('#z').on('click', '.edit', function () {
                    .title('Edit record')

    Still i have only Save button and i cant add another. CustomForm dont want to work too.

    PS. The code has minimal changes compared to the example, but they are not significant (I have 20 such tables on one page - as a calendar)

  • allanallan Posts: 62,246Questions: 1Answers: 10,211 Site admin


    It looks like you are passing the buttons object to the $.ajax configuration object. That is going to be ignored there since jQuery doesn't do anything with a buttons property. Moreover, the code there is for a DataTables Buttons collection - not the buttons found in the Editor form.


    is what defines the button in your editing view. Currently just a button that says "Save" (default action is to submit).

    You need to define your custom button in there:

        label: 'BTN2',
        action: function () {
          // whatever this button is meant to do


Sign In or Register to comment.