Possible to access previous field values when editing

Possible to access previous field values when editing

TomB2015TomB2015 Posts: 19Questions: 6Answers: 0

Hi,

I'm using the DataTables Editor in server-side mode and have the requirement to perform a particular action when a specific field value has changed during an edit operation. When the specific field value hasn't changed, the action would not be performed.

I'm accessing the new field values via the 'data[columnName]' HTTP parameters passed by the editor but I don't believe there is an equivalent way of accessing the values prior to the edit operation.

Is this possible or do you have any pointers on how I could achieve this?

Regards,
Tom

Answers

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

    Just to clarify, you are looking to access the original data on the server-side when an edit request is sent the to the server? If so, the most reliable way of getting that information would be to simply query the database to get the current values.

    Another option would be to use initEdit to store a variable with the existing values for the row (which is passed in as an argument to the event handler), and then send them to the server using ajax.data.

    Regards,
    Allan

  • TomB2015TomB2015 Posts: 19Questions: 6Answers: 0

    Thanks Allan - we are using the second option proposed (initEdit event handler and passing to the server via ajax.data) so we can avoid hitting the database repeatedly during inline editing.

    Regards,
    Tom

This discussion has been closed.