Can't get fnAddData() to work

Can't get fnAddData() to work

acedangeracedanger Posts: 5Questions: 0Answers: 0
edited May 2012 in General
I've been running into problems getting the fnAddData method to work. What am I missing?

The errors I'm receiving are:
[quote]
DataTables warning (table id="current-data"): Requested unknown parameter '4' from the data source for row 14
DataTables warning (table id="current-data"): Requested unknown parameter '0' from the data source for row 14
[/quote]

Below are my column definitions
[code]
'aoColumnDefs' : [
{
'aTargets' : [ 0 ],
'fnRender' : function(oObj) {
return oObj.aData.mins;
}
}, {
'aTargets' : [ 1 ],
'fnRender' : function(oObj) {
return oObj.aData.serviceType;
}
}, {
'aTargets' : [ 2 ],
'fnRender' : function(oObj) {
return oObj.aData.serviceDescription;
}
}, {
'aTargets' : [ 3 ],
'fnRender' : function(oObj) {
var returnVal = '';
switch (oObj.aData.areaType) {
case constants.KIND.FACILITY :
returnVal = constants.AREA_TYPE.FACILITY;
break;
case constants.KIND.GRID :
returnVal = constants.AREA_TYPE.GRID;
break;
case constants.KIND.CITY :
returnVal = constants.AREA_TYPE.CITY;
break;
}
return returnVal;
}
}, {
'aTargets' : [ 4 ],
'fnRender' : function(oObj) {
return oObj.aData.facilityId;
}
}, {
'aTargets' : [ 5 ],
'fnRender' : function(oObj) {
return oObj.aData.areaType === constants.KIND.FACILITY ? '' : oObj.aData.area;
}
}, {
'aTargets' : [ 6 ],
'fnRender' : function(oObj) {
return utility.isEmpty(oObj.aData.expires) === true ? null :
utility.time.reformatDateTime(oObj.aData.expires, 'yyyy-MM-dd HH:mm:ss.s', 'MM/dd/yyyy HH:mm', false);
}
}, {
'bVisible' : false,
'aTargets' : [ 7 ],
'fnRender' : function(oObj) {
return oObj.aData.expires === null ? '12/31/9999' :
utility.time.reformatDateTime(oObj.aData.expires, 'yyyy-MM-dd HH:mm:ss.s', 'MM/dd/yyyy HH:mm', false);
}
}, {
'bVisible' : false,
'aTargets' : [ 8 ],
'fnRender' : function(oObj) {
return oObj.aData.sequenceId;
}
}
]
[/code]

Here is my fnAddData() method call, without data for my hidden columns:
[code]
$('current-data').fnAddData([
selectedPtaBean_.pta,
selectedPtaBean_.serviceType,
'service type desc',
'G/C/F',
selectedPtaBean_.facilityId,
selectedPtaBean_.area,
selectedPtaBean_.expires
]);
[/code]

Here is my fnAddData() method call, with some dummy values for my hidden columns:
[code]
$('current-data').fnAddData([
selectedPtaBean_.pta,
selectedPtaBean_.serviceType,
'service type desc',
'G/C/F',
selectedPtaBean_.facilityId,
selectedPtaBean_.area,
selectedPtaBean_.expires,
selectedPtaBean_.expires, // would be reformatted...
'99999'
]);
[/code]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    What is the value of selectedPtaBean_.pta? Is it null or false or something like that? You might need to specify sDefaultContent (perhaps as an empty string) for these columns.

    Allan
  • acedangeracedanger Posts: 5Questions: 0Answers: 0
    Ah, so if any of the values are null, would I need to specify a default value with sDefaultContent?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    That is correct yes - just a simple empty string would do the business. :-)

    Allan
  • acedangeracedanger Posts: 5Questions: 0Answers: 0
    Thanks for the clarification. I apologize for the late reply.
This discussion has been closed.