tableid = custdatatableXML-Requested unknown parameter 'CUST_FIRSTNAME' for row 0
tableid = custdatatableXML-Requested unknown parameter 'CUST_FIRSTNAME' for row 0
my datat table code is is like this:
/** Method to build data table for user list.*/
function getCustomerDTableXML() {
console.log("customer DTable");
$("#divDefaultInfo").hide(); $("#divCustomer").show();
sltdCustKeys = [];
var col = [];
var hideSort = [];
hideSort.push(0);
hideSort.push(7);
col.push({ "mData": "chkbox", "sWidth": "25px"});
col.push({ "mData": "slNo", "sWidth": "25"});
col.push({ "mData": "CUST_FIRSTNAME", sClass: "text-left", "sWidth": "150px"});
col.push({ "mData": "CUST_LASTNAME", sClass: "text-left", "sWidth": "150px"});
col.push({ "mData": "MOBILE_NO", sClass: "text-left", "sWidth": "100px"});
col.push({ "mData": "EMAIL_ID", sClass: "text-left", "sWidth": "150px"});
col.push({ "mData": "CUST_ADDRESS", sClass: "text-left", "sWidth": "400px"});
$('#custdatatableXML')
.dataTable( {
"bDestroy":true,
"bServerSide": true,
"bProcessing": false,
"bSearchable": false,
"bInfo": true,
"bFilter" :false,
"bAutoWidth" :false,
"iDisplayLength" : oCommon.iRPPage,
"bLengthChange": true,
"iDisplayStart": 0,
"sAjaxSource": $("#SC_CONTEXT_PATH").val() + '/sc/getCustomerDTXML',
"fnServerData": function ( sSource, aoData, fnCallback ) {
$('#custdatatableXML_processing').show();
$('.dataTables_length').hide();
var o = CommonFunctions.StringifyData(aoData);
console.log("JSON.stringify(objCustomer)=======>"+JSON.stringify(aoData));
var arTemp = {};
if(StarsUtility.IsEmptyObject(objCX.params)) {
arTemp = getAllParams();
arTemp["iDisplayStart"] = o.iDisplayStart;
arTemp["iDisplayLength"] = o.iDisplayLength;
} else { arTemp = objCX.params;}
o['dataparams'] = arTemp;
$.ajax({
dataType: 'json',
contentType: "application/json;charset=UTF-8",
type: "POST",
url: sSource,
data: JSON.stringify(o),
success: function(z){
z = buildTableDataXML(z);
objCX.totalRec = z.iTotalRecords;
fnCallback(z);
$('.selectpicker').selectpicker();
//$("#check_all").prop('checked', $(".userchk:checked").length > 0 && $(".userchk:checked").length == $(".userchk").length);
$('#custdatatableXML_processing').hide();
},
error : function (e) {}
});
},
"fnDrawCallback": function ( oSettings ) {
if (this.fnSettings().fnRecordsDisplay() == 0) {
$('#custdatatableXML thead, .dataTables_length, .dataTables_info, .dataTables_paginate').hide();
$('.dataTables_info').parent().hide();
} else {
$('#custdatatableXML thead, .dataTables_length, .dataTables_info, .dataTables_paginate').show();
$('.dataTables_info').parent().show(); $('#divfilters').show();
}
if(oSettings.fnRecordsTotal() <= oCommon.iRPPage) {
$('.dataTables_wrapper > div').css('padding', 0); $('.dataTables_length, .dataTables_paginate').hide(); $('.dataTables_paginate').parent().hide();
$('.block-search').css('top', -15);
}else {$('.dataTables_length, .dataTables_paginate').show(); $('.dataTables_paginate').parent().show();}
CommonFunctions.PageNumbers(objCX.totalRec,'custdatatableXML', oSettings);
},
"oLanguage": {
"sZeroRecords": "No student(s) found.",
"sProcessing": "<div style=\"text-align: center !important; z-index:9999; position: fixed; left:50%; top:50%;\"><i class='icon-spinner icon-spin icon-3x text-success' /></div>"
},
"aoColumnDefs": [{"bSortable": false, "aTargets": hideSort}],
"aoColumns": col,
"aaSorting": [[2,'asc']]
});
}
/**
* Method to re build aoData.
* @param z response returned from server
* @returns rebuilded aoData object for data table to display
* @since v1.0
*/
function buildTableDataXML(z) {
var modAaData = [];
for(var x in z) {
if(x == 'aaData') {
aaData = objCLX.data = z[x];
var j = 0; var iC = 1;
for(var c in aaData) {
var objCX = aaData[c];
var oTemp = {};
var cID = objCX.custID;
var sH = "";
oTemp["chkbox"] = '<input class="custchk" type="checkbox" value="'+ cID +'" id="chk_'+ cID +'" onclick= "javascript:custCheckBoxToggle(this.value);" ' + (jQuery.inArray(cID + "", sltdCustKeys) == -1 ? "" : "checked") +'>';
oTemp["slNo"] = j+1 ;
oTemp["CUST_FIRSTNAME"] = objC.firstName;
oTemp["CUST_LASTNAME"] = objC.lastName;
oTemp["MOBILE_NO"] = objC.mobileNo;
oTemp["EMAIL_ID"] = objC.emailID;
oTemp["CUST_ADDRESS"] = objC.address;
modAaData[j++] = oTemp;
}
if(x = "iTotalRecords"){
objCX.totaldata = z[x];
}
}
}
aaData = modAaData;
z["aaData"] = modAaData;
return z;
}
Answers
I got solution i did mistake here:
old:
oTemp["CUST_FIRSTNAME"] = objC.firstName;
New
oTemp["CUST_FIRSTNAME"] = objCX.firstName;
as i created object for objCX and trying to access by objC