Deleting in json nested data bugged even in example

Deleting in json nested data bugged even in example

thekiller222thekiller222 Posts: 2Questions: 0Answers: 0
edited February 2013 in Editor
Hello, i've been struggling for days with this, when i delete a row there's always the error message " an error has occured" the row is deleted if i refresh but it's really not convenient...

I thought it was from my code until i saw even in the example it's bugged ==> http://editor.datatables.net/release/DataTables/extras/Editor/examples/deepObjects.html

So how to solve this issue??

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Thanks for the link to the test case. That's certainly a bug and I will look into this shortly.

    Allan
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    The reason for the error in the example is the way it tries to assign the row value on delete. This is the code that was in deepObjects.php (specific to that one example only - this is not a general problem with Editor):

    [code]
    else {
    // create, edit or remove
    $json['row'] = nestData( $json['row'] );
    }
    [/code]

    However, on the delete action, there is of course no 'row' parameter since the row has just been deleted!

    The correct code is:

    [code]
    else if ( isset($json['row']) ){
    // create, edit
    $json['row'] = nestData( $json['row'] );
    }
    [/code]

    Which allows it to work as expected.

    Are you using the `row` parameter in a similar manner? If not, what is the return from the server on the delete Ajax request?

    Allan
This discussion has been closed.