fnUpdate() prefix the cell value with '/undefined'
fnUpdate() prefix the cell value with '/undefined'
Hi,
I am using fnUpdate function in the below code
cmpgnDataArray = '105-2014-08-09 00:00:00-00vV00000015shJIAQ';
var eachCmpgnData = cmpgnDataArray.split('-');
var rowIndex = parseInt(eachCmpgnData[0]);
rowIndex = parseInt(eachCmpgnData[0])-1; // as the index starts with 0
var dd = eachCmpgnData[3].substring(0,2);
var dateFormat = eachCmpgnData[2] +'/'+dd+'/'+eachCmpgnData[1];
var contractTable = $('#sconsoletable').dataTable();
var rowData = contractTable.fnGetData(rowIndex);
contractTable.fnUpdate(dateFormat,rowIndex,6,false);
contractTable.fnStandingRedraw();
If I leave the code as above the 6th cell in each row gets updated with the value "/undefined/undefined/08/09/2014"
Right now I am removing the "/undefined/undefined/" section of the value using javascript so that table cell has just the date "08/09/2014".
/* to remove '/undefined/undefined/' */
var currentTdText = $('td.campaignPopLink'+eachCmpgnData[0]).text();
//console.log("currentTdText: "+currentTdText);
if (currentTdText.indexOf("undefined/undefined/")> -1){
currentTdText = currentTdText.replace("undefined/undefined/","");
currentTdText = currentTdText.trim();
//console.log("currentTdText: "+currentTdText);
$('td.campaignPopLink'+eachCmpgnData[0]).text(currentTdText);
}
May I know why the value is getting prefixed? I researched but didn't find anything helpful.
Thanks for your time.
Answers
Hi, Can someone please reply to this. Thanks in advance