Preprocess JSON data just after retrieved from server

Preprocess JSON data just after retrieved from server

jama707jama707 Posts: 1Questions: 1Answers: 0
edited August 2015 in Free community support

How can I preprocess JSON data which is retrieved from datatable ajax call. I want to modify it on client side and pass it to draw - so that it can use modified json.

what i want to achieve is:
Server responds with a response in this format:

data : {
    datatTableResult: [{ }, .... { }],
    additionalData1: {}
    additionalData2: {}

}

I want to pass data.dataTableResult as a source of data for my columns.

Thanks!

Answers

  • allanallan Posts: 64,032Questions: 1Answers: 10,555 Site admin

    Use the ajax.dataSrc option to modify the JSON before returning it to DataTables.

    If all you need to do is tell DataTables where the result data is, just use it as a string: dataSrc: 'data.datatTableResult'.

    Allan

This discussion has been closed.