Obtaining NaN in pagetotal
Obtaining NaN in pagetotal
giulichajari
Posts: 19Questions: 8Answers: 0
live.datatables.net/morayuvu/18/edit
As you can see in te output, the total and pagetotal is NaN. Why?
This discussion has been closed.
Answers
There are some problems with your test case. First you are getting this error in the console:
I added the jquery.js include.
Now its getting this error:
I commented out the
data:data,
option since there is table data.Now this alert message occurs:
Thats causing your column data to have
$NaN
. Please fix the test case to represent your data correctly before we help with the footerCallback.Here is the updated example:
http://live.datatables.net/morayuvu/19/edit
Kevin
Obviously, it can't find the values of the data, because it hasnt the JSON File.
live.datatables.net/morayuvu/21/edit
Now i replace the columns declaration. And it works perfectly, but in my application it goes on showing NaN!
Understood. Take an example of your JSON data and use
data: data
to add it to the table. See this example.Kevin
ok.here you are:
live.datatables.net/morayuvu/22/edit
But now it seems to be counting the number of record, not the content.
You are totaling column 5 which each cell has
1
. So it would look like its counting instead of summing. I updated one of your column 5 values to2
and now the total is5
.http://live.datatables.net/morayuvu/24/edit
Kevin
Because the columns definition remains. live.datatables.net/morayuvu/25/edit
so data appears in whatever place. Now i input the datatable columns, but it goes on the same way
See this [thread]https://datatables.net/forums/discussion/comment/165783/#Comment_165783) to learn how to calculate columns that are using
columns.render
.Kevin