Getting Error "TypeError: Result of expression 'otable' [undefined] is not an object"

Getting Error "TypeError: Result of expression 'otable' [undefined] is not an object"

vijay_makamvijay_makam Posts: 4Questions: 0Answers: 0
edited June 2012 in DataTables 1.9
I am using datatable version 1.9. in phone gap container. I am getting this error.

Error "TypeError: Result of expression 'otable' [undefined] is not an object"

Below is the code. The error is not there when I remove the

otable.$('tr').click( function () {
var rowData = otable.fnGetData( this );
alert( 'The row\'s first cell clicked on had the value of '+rowData[0] );
} );


from the script below. Not able to figure what is the issue.


var otable;
function decorateTable(){
otable = $('#demo').dataTable( {
"sScrollY": "300px",
"bPaginate": true,
"bFilter": false
} );
}
//adding this click function on otable is causing the error
otable.$('tr').click( function () {
var rowData = otable.fnGetData( this );
alert( 'The row\'s first cell clicked on had the value of '+rowData[0] );
} );


$(document).on('pageinit','[data-role=page]',function(){
alert("loaded");
decorateTable();
} );




Any pointers highly appreciated.
This discussion has been closed.