Custom JSON attribute for Total Records?

Custom JSON attribute for Total Records?

jmatt0806jmatt0806 Posts: 2Questions: 1Answers: 0

Have tried finding an answer to this question with no luck:

Is it not possible to map a custom attribute for Total Records?

i.e. If JSON field name is "Total" can it be mapped to "totalRecords"?

Answers

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin

    You can use the ajax.dataSrc option as a function to be able to manipulate the JSON object returned from the server before DataTables uses it. That provides the opportunity to map between parameters however you need.

    Allan

  • jmatt0806jmatt0806 Posts: 2Questions: 1Answers: 0

    Any example of using "dataSrc" to return Total Records available?

    Tried searching, but have yet to find an example.

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin

    Not directly, but the last example on that doc page shows how to use it as a function. Then all you would do is something like json.totalRecords = json.Total;.

    Allan

This discussion has been closed.