Error adding row 1.10.7
Error adding row 1.10.7
reynier
Posts: 4Questions: 0Answers: 0
I have a datatable object and when I justa add a row
f.e.
var data = [];
data[cells.name.id] = "name";
var row = datatable.row.add(data);
(...)
row.draw();
I get this error https://datatables.net/manual/tech-notes/4 but parameter is an object, doing some research I found that mData value from my first column is an object, others are only colid, and thats why i get the error, trying to get cell data from an object.
This discussion has been closed.
Replies
Per the forum rules, can you link to a test case showing the issue please.
It sounds like you might be trying to add an array of data to a DataTable that is configured to expect objects, but without being able to see it, I really can't say for sure.
Allan
Thanks I will try to make and example but meanwhile how can I configure DataTable to expect array?,
Just don't supply the mData option. It will automatically expect an array.
Allan
I think I found the problem but not the solution. In one of my cells (which gives problems) the only thing I have are 3 icons that perform different actions, there are no data so when I just add a new row tries to get the value of this cell and somehow returns undefined throwing the error, I could do something similar to this example https://datatables.net/examples/api/row_details.html but I need 3 or less diferents icons. I guess that if I put "data": null in a columns definitions maybe solve issue but erase my icons.
My temporary solution was to delete the contents of function _fnLog and everything its ok, draw all cells correctly
Use the
columns.render
option as a function withcolumns.data
set tonull
.Allan