Need more explanation about response from server to Editor after successful "CREATE"

Need more explanation about response from server to Editor after successful "CREATE"

com6temcom6tem Posts: 11Questions: 4Answers: 0

Hi Allan,

I have a question about the response returned by the server to editor.
According to your "Client/server data" manual, Editor expects a JSON object to be returned.

But I'm a bit lost and I would need your advice on what would be the correct response for the "CREATE" example below:
(Please note I'm using legacyAjax = true, because I don't need multi-row functionalities).

SENT TO SERVER

action = create
data[job] = Assistant
data[first_name] = Fiona

JSON RESPONSE SENT BACK FROM SERVER TO EDITOR:

RESPONSE 1

{
    "data": [
        {
            "DT_RowId":   "row_29",
            "first_name": "Fiona",
            "job": "Assistant"
        }
    ]
}

RESPONSE 2

{
    "data": [
        {
            "first_name": "Fiona",
            "job": "Assistant"
        }
    ]
}

RESPONSE 3

    "data": [
        {
            "first_name": "Fiona",
            "job": "Assistant"
        }
    ]

RESPONSE 4

    "data":
        {
            "first_name": "Fiona",
            "job": "Assistant" 
        }

RESPONSE 5

        {
            "first_name": "Fiona",
            "job": "Assistant"
        }

RESPONSE 6

    "data": 
        {
            "DT_RowId":   "row_29",
            "first_name": "Fiona",
            "job": "Assistant"
        }

Thanks a lot Allan!
Regards,

This question has an accepted answers - jump to answer

Answers

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

    Hi,

    The problem here is that the legacy mode uses row rather than data - see the legacy client / server documentation.

    Also it is an object rather than an array since the legacy format doesn't support multiple rows.

    For example you would probably want:

    {
        "row": {
                "DT_RowId":   "row_29",
                "first_name": "Fiona",
                "job": "Assistant"
        }
    }
    

    Regards,
    Allan

  • com6temcom6tem Posts: 11Questions: 4Answers: 0

    Thank you Allan, so I will check again the documentation.
    Regards,

This discussion has been closed.