How can I access the information of other pages that is not visible in a table with javascript?
How can I access the information of other pages that is not visible in a table with javascript?
Hi guys, I have a question. I am implementing a table with datatables and I have a question. When making a filter in the input search of the table I want to be able to read all the information of all the pages with javascript to be able to add an amount, but with the javascript code when going through the tbody of the table it only goes through the first sheet with just the first 10 lines that it contains, I would like to be able to read all the pages even if they are not visible
This is what I am currently doing:
d.addEventListener('change', e=> {
if(e.target.getAttribute('type') == 'search'){
if($tbody.children.length > 0){
let netoSumar = 0
let saldoSumar = 0
for(i=0; i< $tbody.children.length; i++){
let valorSaldo = $tbody.children[i].children[8].textContent
}
}else{
console.log($tbody.children)
}
}
})
This question has accepted answers - jump to:
Answers
As long as you aren't using server side processing you can get all the data using
rows().data()
,column().data()
orcells().data()
.Kevin
Here is an example of getting all the data from one column.
http://live.datatables.net/mugokoca/1/edit
Note the use of
toArray()
to create a Javascript array from the API instance returned fromcolumn().data()
.Kevin