Adding rows with named columns when using fnAddTr
Adding rows with named columns when using fnAddTr
Hello all,
in my application, I am using an Ajax request which passes me back the HTML fragment of a to be inserted into the data table.
For doing the insert, I was using Allan Jardine's fnAddTr function.
This post is just to inform other users that I had to adapt Allan's code slightly for my case: I was using named columns (the mData property of each column is set with a fieldname), in this case a hash with the HTML code parts for each cell had to be constructed (otherwise dataTable complained with an error message about "unknown parameter ... ")
[code]
$.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
...
var aData;
// If this table has named columns:
if (oSettings.aoColumns[0].mData) {
var oCells = {};
for (var i=0;i
in my application, I am using an Ajax request which passes me back the HTML fragment of a to be inserted into the data table.
For doing the insert, I was using Allan Jardine's fnAddTr function.
This post is just to inform other users that I had to adapt Allan's code slightly for my case: I was using named columns (the mData property of each column is set with a fieldname), in this case a hash with the HTML code parts for each cell had to be constructed (otherwise dataTable complained with an error message about "unknown parameter ... ")
[code]
$.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
...
var aData;
// If this table has named columns:
if (oSettings.aoColumns[0].mData) {
var oCells = {};
for (var i=0;i
This discussion has been closed.