Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82387

Leave the editor window open after creating a row and do not reset the form

$
0
0

Hello,

I would like to have the possibility to insert several entries with similar content one after the other.
For this I wanted to replace the "Create" button with two buttons: "Create" and "Create and close".
The "Create" button should create an entry but leave the form open so that I can adjust the contents of the form to create another entry.
However, with my current code there is still the problem that the form is reset after creating. Is there a way that this does not happen?

new $.fn.dataTable.Buttons(table, [
    {
        extend: 'create',
        editor: editor,
        formButtons: [
            {
                text: 'Create and close',
                className: 'btn-primary',
                action: function () {
                    this.submit();
                },
            },
            {
                text: 'Create',
                className: 'btn-secondary',
                action: function () {
                    const that = this;

                    this.submit(function () {
                        that.create();
                    }, null, null, false);
                },
            },
        ],
    },
    { extend: 'edit',   editor: editor },
    { extend: 'remove', editor: editor },
]);

Viewing all articles
Browse latest Browse all 82387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>