row disapear after update !

row disapear after update !

smassotsmassot Posts: 28Questions: 9Answers: 1
edited August 2015 in Editor

Hello,
I 've got a problem with row updating in editor.
When I edit a row, after closing the editor frame, edited line disappear form the list. I do'nt touch anything special, I just took examples and try to work on.

what could be the problem ? I didn't make any filters :(

This question has an accepted answers - jump to answer

Answers

  • smassotsmassot Posts: 28Questions: 9Answers: 1
    edited September 2015

    well I think it's probably what I return to the datatable after creating or editing one row that cause my problem.

    datatable data :

    "data": [
             {
                    "DT_RowId": "row_1",
                    "resident": 
                     {
                        "id": "1",
                        "date_modif": "12-01-2015",
                        "id_etablissement": "2",
                        "nom": "BITOUZET",
                        "prenom": "Bernard",
                        "sexe": "H",
                    },
                    "resident_full": 
                    {
                        "id": "1",
                        "date_modif": "12-01-2015",
                        "id_etablissement": "2",
                        "nom": "BITOUZET",
                        "prenom": "Bernard",
                        "sexe": "H",
                    }
               }
          ]
    

    data.resident is for editor
    data.resident_full is for datatable (with full name value)

    $_POST data send by editor :

    data:
        1:                              
            resident:
                nom="BITOUZET" ,
                prenom="Bernard"
    
    .... and so on for all value
    

    and finally what I return after editing :

    {
        "data": {
            "1": {
                "resident": {
                    "id": "1",
                    "date_modif": "09-09-2015",
                    "id_etablissement": "2",
                    "nom": "BITOUZET",
                    "prenom": "Bernard ",
                    "sexe": "H"              
                }
            }
        }
    }
    

    Have I anything wrong ? because after editing a row, the row disapear from datatable until I reload the page.

    Thanks

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi,

    The data parameter that is returned is expected to be an array, not an object. Are you able to modify your server-side return to match what Editor expects?

    Thanks,
    Allan

  • smassotsmassot Posts: 28Questions: 9Answers: 1
    edited September 2015

    Hi allan,
    so bad I am not to see that. Of course there is no problem for returning an array.

    I will try this morning and say if it is ok, thanks a lot.

    EDIT : wonderful, it works perfectly, thanks again :)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Excellent - good to hear. Thanks for the feedback :-)

    Allan

This discussion has been closed.