adding text Element with fnAddData, weird error
adding text Element with fnAddData, weird error
Hello, while trying to dynamically add an html element to my table with fnAddData, I'm getting this weird error
"DataTables warning (table id = 'medSearchResults'): Requested unknown parameter '0' from the data source for row 0"
[code]
$(document).ready(function() {
var medTable = $('#medSearchResults').dataTable( {
"aoColumnDefs": [{ "sClass": "updatebleData", "aTargets": ["_all"] }],
"bJQueryUI": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
} );
var medTable = $('#medSearchResults').dataTable();
var newCell = document.createElement('Text');
medTable.fnAddData([newCell]);
[/code]
Now, everything works fine when I replace my "newCell" element with actual text in the fnAddData
medTable.fnAddData(["sometext"]);
I'm thinking maybe it's not possible to add actual html element like this? Is there any way to create my element before adding it like I'm trying to do?
"DataTables warning (table id = 'medSearchResults'): Requested unknown parameter '0' from the data source for row 0"
[code]
$(document).ready(function() {
var medTable = $('#medSearchResults').dataTable( {
"aoColumnDefs": [{ "sClass": "updatebleData", "aTargets": ["_all"] }],
"bJQueryUI": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
} );
var medTable = $('#medSearchResults').dataTable();
var newCell = document.createElement('Text');
medTable.fnAddData([newCell]);
[/code]
Now, everything works fine when I replace my "newCell" element with actual text in the fnAddData
medTable.fnAddData(["sometext"]);
I'm thinking maybe it's not possible to add actual html element like this? Is there any way to create my element before adding it like I'm trying to do?
This discussion has been closed.