editor.remove button inside editor.edit

editor.remove button inside editor.edit

vinod_ccvvinod_ccv Posts: 75Questions: 0Answers: 0
edited April 2013 in Editor
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

Replies

  • allanallan Posts: 62,211Questions: 1Answers: 10,205 Site admin
    I presume you are using the `remove` API method as a button in the edit view. How are you doing that?

    Allan
  • vinod_ccvvinod_ccv Posts: 75Questions: 0Answers: 0
    Hi 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.
  • allanallan Posts: 62,211Questions: 1Answers: 10,205 Site admin
    edited April 2013
    > parents('tr')[0]

    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
  • vinod_ccvvinod_ccv Posts: 75Questions: 0Answers: 0
    Thank you 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
This discussion has been closed.