Updating a cell of a dynamically created datamodel
Updating a cell of a dynamically created datamodel
sfeu
Posts: 2Questions: 0Answers: 0
Hey,
i am filling my empty datatable dynamically during runtime using the fnAddData method. This works well.
But as soon as i try to update a cell data using fnUpdate with col and row index i got an exception:
Uncaught TypeError: Cannot read property '_aData' of undefined jquery.dataTables.js:782
_fnSetCellData jquery.dataTables.js:782
DataTable.fnUpdate jquery.dataTables.js:5999
(anonymous function)
Here is an example:
$(document).ready(function() {
$('#dynamic').html( '' );
var t = $('#example').dataTable( {
"aoColumns": [
{ "sTitle": "Engine" },
{ "sTitle": "Browser" },
{ "sTitle": "Platform" },
{ "sTitle": "Version", "sClass": "center" },
{
"sTitle": "Grade",
"sClass": "center",
}
]
} );
var row = t.fnAddData(['Other browsers','All others','-','-','U']);
t.fnUpdate( "Misc", row, 0 );
if a use fnUpdate on a prefilled tables is works perfectly. Only if try to update a table that is filled using
fnAddData i get this exception.
Anyone can help me with this problem?
Debugger:
http://debug.datatables.net/uyisat
Regards,
Sebastian
i am filling my empty datatable dynamically during runtime using the fnAddData method. This works well.
But as soon as i try to update a cell data using fnUpdate with col and row index i got an exception:
Uncaught TypeError: Cannot read property '_aData' of undefined jquery.dataTables.js:782
_fnSetCellData jquery.dataTables.js:782
DataTable.fnUpdate jquery.dataTables.js:5999
(anonymous function)
Here is an example:
$(document).ready(function() {
$('#dynamic').html( '' );
var t = $('#example').dataTable( {
"aoColumns": [
{ "sTitle": "Engine" },
{ "sTitle": "Browser" },
{ "sTitle": "Platform" },
{ "sTitle": "Version", "sClass": "center" },
{
"sTitle": "Grade",
"sClass": "center",
}
]
} );
var row = t.fnAddData(['Other browsers','All others','-','-','U']);
t.fnUpdate( "Misc", row, 0 );
if a use fnUpdate on a prefilled tables is works perfectly. Only if try to update a table that is filled using
fnAddData i get this exception.
Anyone can help me with this problem?
Debugger:
http://debug.datatables.net/uyisat
Regards,
Sebastian
This discussion has been closed.
Replies
fnAddData always returns an array. Thus, the array in the row variable causes the trouble in fnUpdate.
Bug report can be closed ;-)
Anyway, maybe it is worth to add a small textual hint for this exception as it seems to occur always if the data is malformed.
Cheers