change column name on the fly
change column name on the fly
how can i change the column name on the fly.
$(rpta).each(function(){
olisttable.fnAddData( [
""+ this.prvid +"",
this.prvtype,
""+this.prvlname + ", " +this.prvfname+"",
this.addrzip,
this.prvpracname,
this.address
]);
when return the data from json, how can i change the column name too?
$(rpta).each(function(){
olisttable.fnAddData( [
""+ this.prvid +"",
this.prvtype,
""+this.prvlname + ", " +this.prvfname+"",
this.addrzip,
this.prvpracname,
this.address
]);
when return the data from json, how can i change the column name too?
This discussion has been closed.
Replies
There isn't a built-in method to change the column name on-the-fly. What you will need to do is simply take the data from your JSON return and then use standard DOM methods to update the column titles as you require.
Regards,
Allan
ID
Specialist Type
Name
ZipCode
Specialist
Practice Address
$("#ides").text('new column name');
$("#esp").text('new column name2');
with this way?
DataTables doesn't really care what the title of the column is, so you can change it as you wish.
Regards,
Allan
document.getElementById('visitsThisPeriodText').innerHTML = 'New text';