Is there any way to customize the response data?

Is there any way to customize the response data?

straylingstrayling Posts: 10Questions: 1Answers: 0

Is there any way to customize the default "recordsTotal/recordsFiltered" key?
This problem sucked me for a couple of hours.
I'm so tired to solve it, but i can't find a solution.
Help me please.

Answers

  • straylingstrayling Posts: 10Questions: 1Answers: 0

    My data is something like:
    {"data":{
    "totalCount":7,
    "rows":[{"id":1,"placeId":"2714ac088a5343959f48a3c8d9d4250a","placeName":""}]
    }}

  • straylingstrayling Posts: 10Questions: 1Answers: 0

    Because the data is created by somebody else, I can't change it.
    I thought datatable is the strongest plugin of tables.
    This problem is so small that I can't imagine it would heppen in this plugin......

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
  • straylingstrayling Posts: 10Questions: 1Answers: 0

    The default key showing how many matched datas is recordsTotal, and it have to be setted on the top level of the response object. {"recordsTotal":"fef"}, but now, my data structure is {data:{ "totalCount":7, "rows"[]}

  • straylingstrayling Posts: 10Questions: 1Answers: 0

    Finally I solve it by adding an api. Oh shit!! Really a wate of time.

  • straylingstrayling Posts: 10Questions: 1Answers: 0
    "recordsFiltered": function(response) {
           return response.data.totalCount;
    }   
    
This discussion has been closed.