Inline edit of one cell with only this one updated field in the ajax answer?

Inline edit of one cell with only this one updated field in the ajax answer?

edmedm Posts: 19Questions: 6Answers: 0

Hi,

when i edit one table cell (Inline edit), then the server have to send all column values for the whole row in the ajax answer. Is it possible to answer only the updated cell content? It's a lot of work to collect the other column informations.

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    why not have a separate ajax call that gets just the needed data and updates the row in question?

    Are you having performance issues that make the recoding effort worth the trouble?

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    What you are looking for should actually be possible with Editor 1.6 now. What version of Editor are you using?

    Allan

  • edmedm Posts: 19Questions: 6Answers: 0

    I am using DataTables-1.10.15 and Editor 1.6.2 (since today).

    My point of view: If i update only one cell (inline editing), then the ajax answer from the server to the client should affect only this cell. How it is possible with version 1.6?

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    It should just happen automatically. Editor stores a copy of the data that was sent to the server and extends that based on what is returned.

    Allan

  • edmedm Posts: 19Questions: 6Answers: 0

    This sounds very good, but do not work for me. I receive this _POST array (ignore the waste "employee" line):

    array(
      ['jobgroupId-1_employeeToken-SKH'] =>
      array(
        ['employee'] => 'AKH'
        ['fr'] => 2
      )
    )
    

    and send back the whole row content to the client:

    {
        "DT_RowId": "jobgroupId-1_employeeToken-SKH",
        "employeeAndWorkload": "SKH",
        "mo": 1,
        "tu": 1,
        "we": 2,
        "th": 2.12,
        "fr": 2,
        "sa": 2
    }
    

    That works.

    But if i left some/many of the columns, eg
    {"data":[{"DT_RowId":"jobgroupId-1_employeeToken-SKH","fr":1}]}
    i got an error:
    DataTables warning: table id=table_weeksGroupsTable1 - Requested unknown parameter 'employeeAndWorkload' for row 5, column 0. For more information about this error, please see http://datatables.net/tn/4

    How should the server answer looks like?

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    The issue is that Editor will extend what it sends to the server. Not what currently exists in the DataTable for that row. So if you are only sending employee and fr, those are the only two parameters that the server could not respond with...

    I can certainly see how it would be useful to be able to use the whole row and I will look into that in future. For the moment, the only option would be to use postSubmit, get the data for the edited row from the DataTable and do a $.extend() on that.

    Regards,
    Allan

  • edmedm Posts: 19Questions: 6Answers: 0

    Editor will extend what it sends to the server. Not what currently exists in the DataTable for that row.

    Ah, this is not my way of thinking in that case.

    and I will look into that in future.

    Ok, i am waiting and i do hope for that feature (server answer affects only changed content) in the near future ;). Thank you for explanation.

This discussion has been closed.