Delete-button with confirmation in inline form commands
Delete-button with confirmation in inline form commands
hasenumberone
Posts: 14Questions: 1Answers: 0
In the example for inline form commands the records will be deleted without confirmation. How can i change that?
[code]// Delete a record (without asking a user for confirmation)
$('#example').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor.remove( $(this).parents('tr')[0], '123', false, false );
editor.submit();
} );[/code]
[code]// Delete a record (without asking a user for confirmation)
$('#example').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor.remove( $(this).parents('tr')[0], '123', false, false );
editor.submit();
} );[/code]
This discussion has been closed.
Replies
[code]
// Delete a given row with a message to let the user know exactly what is
// happening
editor.message( "Are you sure you want to remove this row?" );
editor.remove( row_to_delete, 'Delete row', {
"label": "Confirm",
"fn": function () { this.submit(); }
} );
[/code]
Note that the difference is the code in the live example will automatically call `submit` while the example in the documentation uses a callback for it, which is triggered in the button.
Allan
[code]
$('#example').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor.message( "Are you sure you want to remove this row?" );
editor.remove( $(this).parents('tr')[0], 'Delete row', {
"label": "Confirm",
"fn": function () { this.submit(); }
} );
} );
[/code]
Allan
// Delete a record (without asking a user for confirmation)
$("#adminix_gallery_fotos").on("click", "a.editor_remove", function (e) {
e.preventDefault();
editor.message( "Are you sure you want to remove this row?" );
editor.remove( $(this).parents("tr")[0], "Delete row", {
"label": "Confirm",
"fn": function () { this.submit(); }
} );
} );
[/code]
This works.