$.fn.DataTable.fnIsDataTable consistenly returns false.
$.fn.DataTable.fnIsDataTable consistenly returns false.
ericDecker
Posts: 15Questions: 0Answers: 0
Hello,
I'm loading DataTables on click, rather than page load and I'm trying to develop a test condition to know when I should be rendering the table or the click action should just perform other functions. So the function fnIsDataTable seemed to be perfect, however, I cannot get it to return anything but false. I've tried running this on a long setTimeout inside document.ready, in the table's draw callback and just straight up after the DataTable initialization in the click handler.
At first I thought it was because I'm using sScroll features and that when you use it, the ID is no longer visible in the page. However, I am able to successfully log the element to the console. And I took off the scrolling and it still happened.
Any advice?
I'm loading DataTables on click, rather than page load and I'm trying to develop a test condition to know when I should be rendering the table or the click action should just perform other functions. So the function fnIsDataTable seemed to be perfect, however, I cannot get it to return anything but false. I've tried running this on a long setTimeout inside document.ready, in the table's draw callback and just straight up after the DataTable initialization in the click handler.
At first I thought it was because I'm using sScroll features and that when you use it, the ID is no longer visible in the page. However, I am able to successfully log the element to the console. And I took off the scrolling and it still happened.
Any advice?
This discussion has been closed.
Replies
Example of it working: http://live.datatables.net/ifivej/edit#javascript,html
Allan
It's working now that I added the index selector. When I had been trying in the past I was working off of the Reference page where it does not use jQuery but document.getElementById. Perhaps it would be appropriate to update the Reference to use this jQuery methodology rather than the javascript getElementId approach which was consistently returning false?
Allan