count item filtered and show in the page
count item filtered and show in the page
m75sa
Posts: 132Questions: 30Answers: 0
Hi all,
I'm searching a way to count items filtered and show the result in the html page, on the bottom or on the top.
For example if you see this demo:
http://live.datatables.net/geconesi/1/
what I need is a box or something else, on the bottom/top area of the page, that catch dynamically the total number of each single column of the table... do you think can be possible?
This question has an accepted answers - jump to answer
Answers
Do you mean like shown in this example?
Allan
yes, quite the same but:
i need total for each column and to be placed in different part of the page.. so i can display the single totale not forcibly under the column but also in other part of the page... possible?
to be more precisely i'm going to create a div... or a block, under the table that must contains all totals displayed from the table. .. and the values of course will change dynamically from the table select filter...
This is the code that updates the HTML:
You can change the selector (
api.column( 4 ).footer()
) with any selector you wish. Doesn't have to be in the footer. If it makes more sense to you thatfoorterCallback
code can be moved intodrawCallback
.Kevin
thanks to your help i discover the possibility to add values outside the table.
What i'm still down is to adapt your script to that one that searches on each columns.
So script edited is:
live.datatables.net/geconesi/2/edit
but i cannot adapt it to this one:
live.datatables.net/geconesi/3/edit
where do i wrong?
If i add the bloc inside the function it doesn't work...
live.datatables.net/geconesi/3/edit
and in particular i would like to display the total of each column row...
any help?
Thanks a lot my friend!
Hi @kthorngren ,
i found this:
https://datatables.net/forums/discussion/59587/count-number-of-searched-rows-after-dropdown-menu-changes
but i was not able to replicate the sample... any help?
This example is counting both the filtered and non-filtered, that should get you going,
Colin