fnGetPosition on a causes an error
fnGetPosition on a causes an error
dondochaka
Posts: 3Questions: 0Answers: 0
I'm getting
[code]Uncaught TypeError: Cannot read property 'nTr' of undefined[/code]
when I try to do
[code]
$(table).find(".myClass").each(function (index, value) {
var dtIndex = table.fnGetPosition( this );
...
[/code]
table is the result of a .dataTable call on a dom element saved in a variable and fully initialized. The results of the .find() are some elements that have been initialized with bVisible as false.
Any ideas?
[code]Uncaught TypeError: Cannot read property 'nTr' of undefined[/code]
when I try to do
[code]
$(table).find(".myClass").each(function (index, value) {
var dtIndex = table.fnGetPosition( this );
...
[/code]
table is the result of a .dataTable call on a dom element saved in a variable and fully initialized. The results of the .find() are some elements that have been initialized with bVisible as false.
Any ideas?
This discussion has been closed.
Replies
Allan
The error occurs when the toggle function is called. I realized that if I set bVisible to false it actually prevents the .find() from matching the columns, so I tried it another way (toggle2()) hoping that it would find the TH's according to the documentation here http://datatables.net/api. Turns out that it doesn't just not find just the TH's with bVisible set to false, it doesn't find any of them. Am I using it wrong?
From your code - you want to get the column index of the column, based on its current position - is that correct? For that, use this plug-in: http://datatables.net/plug-ins/api#fnVisibleToColumnIndex
Allan