Can't get fnAddData() to work
Can't get fnAddData() to work
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]
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]
This discussion has been closed.
Replies
Allan
Allan