TypeError: oCol is undefined - during Dynamic Table Creation.
TypeError: oCol is undefined - during Dynamic Table Creation.
I am getting oCol is undefined error during dynamic table creation.
find the below .js code
var resultDiv=$('#loadData');
if(GridInitialised==false)
{
var newDataTable=$('');
$(resultDiv).html(newDataTable);
}
gridBody = $('tbody',$('table',resultDiv));
$("filestatus", constructXML).each(function() {
tr = document.createElement('tr');
$(tr).attr('valign','middle');
var obj = this;
var env=$(obj).text().substring(0,($(obj ).text().indexOf(":")));
var fileStatus=$(obj).text().substring(($(obj ).text().indexOf(":")+1));
var rowHtml=""+env+"" +
""+fileStatus+"" +
"" +
"Edit";
$(tr).append(rowHtml);
$(gridBody).append(tr);
});
$('button').button();
if(GridInitialised==true)
{
$('#dataGrid').dataTable().fnDestroy();
}
$('#dataGrid').dataTable({
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bProcessing" : true,
"aoColumns" : [ {"sTitle" : "Environment"}, {"sTitle" : "Status"}]
});
GridInitialised=true;
tr=null;
obj =null;
}
HTML:
the table is getting generated but it is not binding to the data table but getting the error TypeError: oCol is undefined.
please help me where i am wrong.
find the below .js code
var resultDiv=$('#loadData');
if(GridInitialised==false)
{
var newDataTable=$('');
$(resultDiv).html(newDataTable);
}
gridBody = $('tbody',$('table',resultDiv));
$("filestatus", constructXML).each(function() {
tr = document.createElement('tr');
$(tr).attr('valign','middle');
var obj = this;
var env=$(obj).text().substring(0,($(obj ).text().indexOf(":")));
var fileStatus=$(obj).text().substring(($(obj ).text().indexOf(":")+1));
var rowHtml=""+env+"" +
""+fileStatus+"" +
"" +
"Edit";
$(tr).append(rowHtml);
$(gridBody).append(tr);
});
$('button').button();
if(GridInitialised==true)
{
$('#dataGrid').dataTable().fnDestroy();
}
$('#dataGrid').dataTable({
"bJQueryUI" : true,
"sPaginationType" : "full_numbers",
"bProcessing" : true,
"aoColumns" : [ {"sTitle" : "Environment"}, {"sTitle" : "Status"}]
});
GridInitialised=true;
tr=null;
obj =null;
}
HTML:
the table is getting generated but it is not binding to the data table but getting the error TypeError: oCol is undefined.
please help me where i am wrong.
This discussion has been closed.
Replies