Inline editor isn't closing after submission

Inline editor isn't closing after submission

AaronsAarons Posts: 13Questions: 5Answers: 0

I'm using inline editing, with a custom ajax call. After upgrading to the latest version of the editor (v1.5.5), the inline form no longer closes after calling the success method.

Everything else works correctly, and the call is made to the API.

Any idea why it isn't closing the editor?

Here's the ajax part of the table:

     ajax: function (method, url, data, onSuccess, onError) {

            $.ajax({
                'type': 'POST',
                'contentType': 'application/json; charset=utf-8',
                'url': "api/mywebservice",
                'data': JSON.stringify({ ...my custom data...}),
                'dataType': 'json',
                'dataSrc': '',
                'cache': false,
                success: function (json) {
                    onSuccess(json);

                },
                error: function (xhr, error, thrown) {
                    alert("error!");
                    onError(xhr, error, thrown);   
                }
            });
        }

Cross posted here: http://stackoverflow.com/questions/35762305/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    What is the data that is contained in the json variable? Does it match the client / server communication required by Editor?

    Allan

  • AaronsAarons Posts: 13Questions: 5Answers: 0

    The json going up does not conform, that's why I'm using the custom ajax call.

    The return json data is in the correct format (otherwise I get errors), but does not contain every field needed to re-render the table row. I'm only sending back the fields that were sent up.

    Do I need to send back every field needed to re-render the row, or is there a way to bypass this?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Yes, you need to send back all of the fields in the row. The reason for this is that Editor allows for fields which might have been updated by the server (last updated date, a counter, etc). I plan to relax that constraint in future, but at this moment, this is required.

    Allan

  • AaronsAarons Posts: 13Questions: 5Answers: 0

    Allan,

    Thank you for the help, that did resolve my issue.

    As a request, I would like to be able to override this, especially if I'm already overriding the initial ajax request.

    I have quite a few columns in my table, and each row requires quite a bit of calculation to render them. I don't really want to have to recalculate the entire row every time a single field is updated, especially if someone is updating a lot of values.

    Thank you again.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    You could possibly use the modifier() method to get the data for the row in question from the DataTable and then extend that with the limited response from the server and then use the resulting object to update the table.

    However, that is a bit of a faff - as I say, I plan to relax this constraint and effectively have that operation performed automatically in future.

    Allan

This discussion has been closed.