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 General
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.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Please do not cross post: http://datatables.net/forums/discussion/10206

    See: http://datatables.net/forums/discussion/9719/how-to-ask-for-help and please give us a link to a test page showing the error.

    Allan
This discussion has been closed.