Row.add option
Row.add option
dkweb
Posts: 2Questions: 1Answers: 0
i use the following:
.row
.add([
person.id,
person.name,
person.control
])
.draw()
Is it possible to pass an object or array directly using row.add.draw option?
i.e.
.row
.add([person])
.draw()
i prepare data in my model and object params equal number of columns...
Thanks in advance
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sure - just do
row.add( person )
if person is either an object or array that matches the data format that DataTables has been told to use (e.g. through the use ofcolumns.data
).Allan
Dear Allan! First of all thanks for a great plugin.
Sure, i tried to do so.. but may be the problem is that i do not define columns...
var table = $('#tab1').DataTable(
This is the only what i have
If that is the case then DataTables is expecting arrays for the data in each row. You need to give it the same format that it has been "told" to expect in
row.add()
.You can use
columns.data
to read data into an object structure as this example shows which you might find useful.Allan