Add Cancel button to all windows of editor
Add Cancel button to all windows of editor
How can I do it? I've managed to make it for edit window like this:
container.editor
.title( 'Edit record' )
.buttons([
{ "label": "Update", "fn": function () { container.editor.submit() } },
{ "label": "Cancel", "fn": function () { container.editor.close() } }
]
)
.edit( $(this).parents('tr') );
but can't make it for create window.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You should be able to do the same using
create()
:This is assuming of course that you are not using the TableTools buttons (are you?).
Allan
Thank you Allan. Actually for creating record I use TableTools button. How can I bind to Create button of tableTools?
The Editor form buttons, for the TableTools buttons, are defined by
$.fn.dataTable.TableTools.BUTTONS.editor_create
(andeditor_edit
/editor_remove
).So you would assign your button array to that variable.
Regards,
Allan
Ok. I've tried
$.fn.dataTable.TableTools.BUTTONS.editor_create=[
{ "label": "Save", "fn": function () { container.editor.submit() } },
{ "label": "Cancel", "fn": function () { container.editor.close() } }
];
but have got the error 'TypeError: a.sAction is undefined'
Sorry! My mistake - I give you the reference to the full TableTools button configuration - not the Editor buttons in it. It should be:
$.fn.dataTable.TableTools.BUTTONS.editor_create.formButtons
:Allan
Thank you Allan. Now everything working fine