How to generate sEcho ??
How to generate sEcho ??
nathanseo
Posts: 7Questions: 2Answers: 0
Totally blown away by how useful datatables is, however i'm having an issue generating the correct json format in codeigniter.
I'm trying to get the total (sum) of a column but it always returns NaN, but i've noticed my json format appears different, for example.
The sEcho format should look like this
"sEcho": 1,
"iTotalRecords": 2,
"iTotalDisplayRecords": 2,
"aaData": []
However, I'm receiving a format like this
"draw": 0,
"recordsTotal": 38,
"recordsFiltered": 38,
"data": []
This discussion has been closed.
Answers
Hi,
The first format you show is the legacy format. The second is the current. To force one format or the other see the server-side processing documentation.
I would suggest using the new format if you can rather than the legacy format.
Allan
Ok i'm using 1.9 so I guess thats ok, but i'm gonna have to look into different methods for the footercallback and sum, do you guys offer development for such requests?
If you are new to Dt, you really want to move up to 1.10 and the current syntax. Sticking with the legacy syntax will limit the amount of community based support you can get.
What do you want to do with the footercallback and sums? Did you look at the example on column sums?
Hi ThomD, I just want to get the total sum of columns in range and page, I've checked out tutorials and guides but i'm still getting NaN, my code currently looks like this..
Returning anything other than NaN would be a start, i've tried parseInt & Number also
Ok I've done it!!
I changed this -> iTotalRecords += aoData[i]['deposit_amount']*1;
Cheers guys, great stuff