show every column in dataset
show every column in dataset
walczak
Posts: 4Questions: 2Answers: 0
I know that i have to define every column by hand:
i.e.
columns: [
{data: "offer_id" },
{data: "number"}
]
Is there an option to show automaticaly every Datacolumn from the ajax request?
ajax resonse is like this
data.id
data.number
data.name
data.stringOne
data.stringTwo
data.stringThree
And i do not want to define every data paramter from hand.
Perhaps something like this?
columns: [all]
or ?
columns: [function ( ) {
allcolumns.forEach(function(value) {
...?..;
});
return value;]
Any idead how to solve an elastic column definition?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to use jQuery ajax instead of
ajax
for dynamic columns. This example shows building the columns from the first row of data from the ajax response.http://live.datatables.net/huyexejo/1/edit
Kevin
Super, thank you!