Dyanmically change column data
Dyanmically change column data

$(document).ready(function() {
$('#example').DataTable( {
"ajax": "data/objects.txt",
"columns": [
// change this data
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
} );
is there a way to dynamically change column data ?
This discussion has been closed.
Replies
Yes. You can use
row().data()
orcell().data()
.If this doesn't help then please provide more details of how you want to change the data.
Kevin
its change value of column.
what i mean is change the column name that used to call api.
everytime datatable try to call api its got request like this:
i want to change that
columns[0][data]
dynamically cause its affect the order column in backendits something like this
No, there is not. a feature in Datatables to dynamically change the column names. The
columns.data
is used to define the object property for the column. You can change this by usingdestroy()
and reinitializing the columns with the desired object properties but I'm guessing this isn't what you want.You will probably need to change something in your server script to not affect the order. If you want help with this please post your script and details of the problem. Someone may be able to offer suggestions.
Kevin