editor.remove button inside editor.edit
editor.remove button inside editor.edit
Hi Allan,
I felt, it will be better to see the data before removing it by editor( Of course, the confirmation will do, but does not give details about the row which is clicked)
I tried to add editor.remove as button function in editor.edit..doesn't work. Also tried it as a button label inside editor.edit and wanted to ON click function to delete ..that also didn't work.
Any suggestion for me?
Regards
Vinod
I felt, it will be better to see the data before removing it by editor( Of course, the confirmation will do, but does not give details about the row which is clicked)
I tried to add editor.remove as button function in editor.edit..doesn't work. Also tried it as a button label inside editor.edit and wanted to ON click function to delete ..that also didn't work.
Any suggestion for me?
Regards
Vinod
This discussion has been closed.
Replies
Allan
This is some thing I tried.
[code]
editor.edit($(this).parents('tr')[0],
'Edit the record',[
{
"label": "Delete this entry",
"fn": function () {
editor.message( "Are you sure you want to remove this record?" );
editor.remove( parents('tr')[0], 'Delete row', {
"label": "Confirm",
"fn": function () { this.submit(); }
} );
}
},
{
"label": "Save this entry",
"fn": function () {
this.submit();
}
}
])
[/code]
So it start as edit view with two buttons on to save if it is edited. On clicking second button it should call Delete function and remove the row after confirmation message. But it comes up up to confirmation message after that it does not work.
What is the `parents()` function? Are you not getting a Javascript error at that point? I'd guess you need to save the row being edited to a variable so you can reuse it in the remove button function.
Allan
Yes, parents('tr')[0] was the row selected on click. And Made it reused after saving it as a variable as you told.
Its working fine as expected.
Thank you
Vinod