I have an error: ''oSettings.aoData[iRow] is undefined" in script
I have an error: ''oSettings.aoData[iRow] is undefined" in script
Hi, i have a problem with this (look in the title). My source:
[code]
var oTable;
function fnFormatDetails ( nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Identyfikator:'+aData[1]+'';
sOut += 'Imi? i nazwisko:'+aData[2]+' '+aData[3]+'';
sOut += 'Adres:'+aData[4]+' '+aData[5]+', '+aData[6]+'';
sOut += 'PESEL:'+aData[15]+'';
sOut += 'NIP:'+aData[14]+'';
sOut += 'Data przyst?pienia:'+aData[9]+'';
sOut += 'Kontakt:e-mail:'+aData[7]+', telefon: '+aData[8]+'';
sOut += 'IP:'+aData[10]+'';
sOut += '';
return sOut;
}
function fnOpenClose ( oSettings )
{
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
this.src = "./media/images/details_open.png";
/* fnClose doesn't do anything for server-side processing - do it ourselves :-) */
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
/* Open this row */
this.src = "./media/images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"sAjaxSource": "./server_processing.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
{ "bVisible": false },
null,
null,
null,
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
null,
{ "bVisible": false },
{ "bVisible": false, "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "bVisible": false },
{ "bVisible": false }
],
"aaSorting": [[2, 'asc']],
"fnDrawCallback": fnOpenClose
} );
} );
[/code]
But the error pointing on 9th line: (in script Data Tables)
[code]
this.fnGetData = function( mRow )
{
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
if ( typeof mRow != 'undefined' )
{
var iRow = (typeof mRow == 'object') ?
_fnNodeToDataIndex(oSettings, mRow) : mRow;
---> return oSettings.aoData[iRow]._aData; <---
}
return _fnGetDataMaster( oSettings );
};
[/code]
Please help.
[code]
var oTable;
function fnFormatDetails ( nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Identyfikator:'+aData[1]+'';
sOut += 'Imi? i nazwisko:'+aData[2]+' '+aData[3]+'';
sOut += 'Adres:'+aData[4]+' '+aData[5]+', '+aData[6]+'';
sOut += 'PESEL:'+aData[15]+'';
sOut += 'NIP:'+aData[14]+'';
sOut += 'Data przyst?pienia:'+aData[9]+'';
sOut += 'Kontakt:e-mail:'+aData[7]+', telefon: '+aData[8]+'';
sOut += 'IP:'+aData[10]+'';
sOut += '';
return sOut;
}
function fnOpenClose ( oSettings )
{
$('td img', oTable.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
this.src = "./media/images/details_open.png";
/* fnClose doesn't do anything for server-side processing - do it ourselves :-) */
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
/* Open this row */
this.src = "./media/images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sDom": 'T<"clear">lfrtip',
"sAjaxSource": "./server_processing.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
{ "bVisible": false },
null,
null,
null,
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
null,
{ "bVisible": false },
{ "bVisible": false, "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "bVisible": false },
{ "bVisible": false }
],
"aaSorting": [[2, 'asc']],
"fnDrawCallback": fnOpenClose
} );
} );
[/code]
But the error pointing on 9th line: (in script Data Tables)
[code]
this.fnGetData = function( mRow )
{
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
if ( typeof mRow != 'undefined' )
{
var iRow = (typeof mRow == 'object') ?
_fnNodeToDataIndex(oSettings, mRow) : mRow;
---> return oSettings.aoData[iRow]._aData; <---
}
return _fnGetDataMaster( oSettings );
};
[/code]
Please help.
This discussion has been closed.
Replies
change this part:
[code]
this.fnGetData = function( mRow )
{
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
if ( typeof mRow != 'undefined' )
{
var iRow = (typeof mRow == 'object') ?
_fnNodeToDataIndex(oSettings, mRow) : mRow;
---> return oSettings.aoData[iRow]._aData; <---
}
return _fnGetDataMaster( oSettings );
};
[/code]
with this part:
[code]
this.fnGetData = function( mRow )
{
var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] );
if ( typeof mRow != 'undefined' )
{
var iRow = (typeof mRow == 'object') ?
_fnNodeToDataIndex(oSettings, mRow) : mRow;
if( typeof oSettings.aoData[iRow] != 'undefined')
return oSettings.aoData[iRow]._aData;
}
return _fnGetDataMaster( oSettings );
};
[/code]