oTable in 1.9.4 has no fnIsOpen? "TypeError: Object [object Object] has no method 'fnIsOpen'"
oTable in 1.9.4 has no fnIsOpen? "TypeError: Object [object Object] has no method 'fnIsOpen'"
devgreer
Posts: 9Questions: 0Answers: 0
I clipped some example code and stuck it into my dataTable like this:
[code]
"fnInitComplete": function(oSettings, json) {
jQuery('#data tbody tr').click( function () {
if ( oTable.fnIsOpen(this) ) {
oTable.fnClose( this );
} else {
oTable.fnOpen( this, "Temporary row opened", "info_row" );
}
} );
},
[/code]
Got this error "TypeError: Object [object Object] has no method 'fnIsOpen'".
Then I cut the snippet down to this, and it worked:
[code]
"fnInitComplete": function(oSettings, json) {
jQuery('#data tbody tr').click( function () {
oTable.fnOpen( this, "Temporary row opened", "info_row" );
} );
},
[/code]
Of course it doesn't close the opened row, though. Why is fnIsOpen not recognized here?
[code]
"fnInitComplete": function(oSettings, json) {
jQuery('#data tbody tr').click( function () {
if ( oTable.fnIsOpen(this) ) {
oTable.fnClose( this );
} else {
oTable.fnOpen( this, "Temporary row opened", "info_row" );
}
} );
},
[/code]
Got this error "TypeError: Object [object Object] has no method 'fnIsOpen'".
Then I cut the snippet down to this, and it worked:
[code]
"fnInitComplete": function(oSettings, json) {
jQuery('#data tbody tr').click( function () {
oTable.fnOpen( this, "Temporary row opened", "info_row" );
} );
},
[/code]
Of course it doesn't close the opened row, though. Why is fnIsOpen not recognized here?
This discussion has been closed.
Replies
[code]
"fnInitComplete": function(oSettings, json) {
var that = this;
jQuery('#data tbody tr').click( function () {
that.fnOpen( this, "Temporary row opened", "info_row" );
} );
},
[/code]
In fnInitComplete `this` should `=== oTable` - but it depends upon the rest of your code and what options you set. Using `this` is safer.
Allan