DataTable is the most powerful tool to sort data in tables but I still struggle how to handle DataTable cells' content properly by JavaScript. I use Ajax to load data into the table and then I can't find the part of my data in the DOM.
I've created a simple table model of what I want to have done.
https://jsfiddle.net/andrew45/g5v03pt7/2/
I load the test_array.txt file into my table, then I add an additional row (jRow = $('<tr class=user_row>').append
). Later I need to modify the "Days" column by JavaScript (document.getElementsByClassName('days')[i].innerHTML = days
).
1) The main problem is that I can access through DOM to the first page of my DataTable only (paging: true
). Note that the "Days" are not calculated in the second or other pages. Unfortunately, I need a large table, so I can't always use the option paging: false
which helps.
2) Is there a smarter option to check the DataTable availability without using setTimeout()
function? You can uncomment two alerts in my code to understand better what's going on.