Why the fnAddData not working with using sAjaxSource?

Why the fnAddData not working with using sAjaxSource?

oracleioraclei Posts: 4Questions: 0Answers: 0
edited May 2013 in DataTables 1.9
The code and html too long ,so I condense it ,as follow:

The html:
[code]


Employee List








<!-- /datatables -->
<!-- /center -->
<!--/row-->

[/code]

The Datatables definition:
[code]
function dataTablesInitialize(tableId){
oTable = $(tableId).dataTable({
"oLanguage":{..... },

"bSortClasses": false,
"bScrollCollapse": true,
"bDeferRender": true,
"sAjaxSource": tableLoadUrl,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": tableLoadUrl,
"success": function(result){
if(result.isOK){
oTable.fnClearTable();
oTable.fnAddData(result.aaData);
}else{
ajaxValidateError(result.sMessage);
}
},
"failure":function(result){ajaxCallError(result);}
} );
},
"sPaginationType": "full_numbers",
"sScrollX": "100%",
"sScrollXInner": "110%",
"sServerMethod":"POST",

"fnDrawCallback": function( oSettings ) { ... },

"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {...},

"aoColumns" : [{
"mData" : "id",
"bSearchable" : false,
"sClass" :"control"
},{
"mData" : "employeeName",
"sWidth" : "40px"
},{
"mData" : "employeeId",
"bVisible" : false
},{
"mData" : "doneDate",
"bSearchable" : false,
"bVisible" : false
},{
"mData" : "a1",
"bSearchable" : false
},{
"mData" : "a2",
"sWidth" : "40px"
},{
......
}]
});
};
[/code]

The caller function:

[code]
function getValuesFromDialog(){
var aData=new Array();
aData["id"] = $(dialogId+' #id').val();
aData["employeeName"] = $(dialogId+' #employeeName').val();
aData["employeeId"] = $(dialogId+' #employeeId').val();
aData["doneDate"] = $(dialogId+' #doneDate').val();
aData["a1"] = $(dialogId+' #a1').val();
aData["a2"] = $(dialogId+' #a2').val();
aData["b1"] = $(dialogId+' #b1').val();
aData["b2"] = $(dialogId+' #b2').val();
aData["c1"] = $(dialogId+' #c1').val();
....
return aData;
}


function dialogSumbit(){
var aData = getValuesFromDialog();
if(dialogMode == DIALOG_MODIFY){
oTable.fnUpdate(aData);
}else{
var a = oTable.fnAddData(aData);
oTable.fnDraw();
console.log(a[0]);
}
return false;
}
[/code]
I have an empty datatables, and when I click a button on html,then popup a dialog modal, I input something,then click submit button,
it call the "dialogSubmit()", then call oTable.fnAddData(aData), return nothing, and no error report, and the table nothing display.
This discussion has been closed.