aaData.length is null but json data is there.
aaData.length is null but json data is there.
JSON in DataTest.txt
[{"VEH_SPEC_ID":1702,"PRCNG_DSC":"Confirmed","YMMS_ID":560745,"MFR_CDE":"FORD","CNTRY_ISO_CDE":"USA","VEH_YR_NBR":2013,"MAKE_CDE":"FORD","MODL_CDE":"EXPL","SERS_CDE":"1LT2","YMMS_DSC":"Explorer XLT FWD 202A Pk-Lthr"}]
[code]
var url = "DataTest.txt";
oTable = $('#tbVehSpec').dataTable({
"bProcessing": true,
"sAjaxSource": url,
});
[/code]
So why is json showing up in the first element here and the aaData is null?
Here is where it is failing in the java variable json has my data in its first element but aData.Length is null and thus it fails.
[code]
/* if there is an ajax source load the data */
if (oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {
var aoData = [];
_fnServerParams(oSettings, aoData);
oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData, function (json) {
var aData = (oSettings.sAjaxDataProp !== "") ?
_fnGetObjectDataFn(oSettings.sAjaxDataProp)(json) : json;
/* Got the data - add it to the table */
for (i = 0 ; i < aData.length ; i++) {
_fnAddData(oSettings, aData[i]);
}
[/code]
Any ideas?
[{"VEH_SPEC_ID":1702,"PRCNG_DSC":"Confirmed","YMMS_ID":560745,"MFR_CDE":"FORD","CNTRY_ISO_CDE":"USA","VEH_YR_NBR":2013,"MAKE_CDE":"FORD","MODL_CDE":"EXPL","SERS_CDE":"1LT2","YMMS_DSC":"Explorer XLT FWD 202A Pk-Lthr"}]
[code]
var url = "DataTest.txt";
oTable = $('#tbVehSpec').dataTable({
"bProcessing": true,
"sAjaxSource": url,
});
[/code]
So why is json showing up in the first element here and the aaData is null?
Here is where it is failing in the java variable json has my data in its first element but aData.Length is null and thus it fails.
[code]
/* if there is an ajax source load the data */
if (oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {
var aoData = [];
_fnServerParams(oSettings, aoData);
oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData, function (json) {
var aData = (oSettings.sAjaxDataProp !== "") ?
_fnGetObjectDataFn(oSettings.sAjaxDataProp)(json) : json;
/* Got the data - add it to the table */
for (i = 0 ; i < aData.length ; i++) {
_fnAddData(oSettings, aData[i]);
}
[/code]
Any ideas?
This discussion has been closed.
Replies
2. Use mData to tell DataTables what data to use for each column from the objects for each row.
Allan