The node function of row.add() API return instance returns null .
The node function of row.add() API return instance returns null .
casuist
Posts: 41Questions: 16Answers: 0
in DataTables 2
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
1.13.11 version
return node value.
2.0.3 version
return node null
newRow = table.row.add(item);
node = newRow.node() return null.
but!!!
newRow = table.row.add(item).draw();
node = newRow.node() return node value.
I want the node value. But without a draw.
help me.
Answers
Disable the
deferRender
option. It is enabled in DataTables 2 and causes the row nodes to be created only when needed by a draw action. Disabling it (deferRender: false
) will cause the row node and cells to be created immediately.Allan
thanks.
deferRender: false set.
return tr html.
but node value is not effect td className.
older version 1.13.11
returns className effected value.
Can you link to a test case showing the issue so I can look into it please?
Allan
Your first code snippet, without
draw()
, works with DT 2.0.3 in this test case:https://live.datatables.net/taxareri/1/edit
Note
deferRender
is setfalse
.Please provide a link to a test case showing the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
https://live.datatables.net/taxareri/1/edit
console.log ->
<tr><td>Tiger Nixon1</td><td>Javascript Developer</td><td>New York</td><td>33</td><td>2012/12/02</td><td>$4,080</td></tr>
example
table config
...
comlumns: [
{
title: "title",
data: "colulm1",
className: "text-end",
},
]
...
after row.add()
want value =>
<tr><td class="text-end">some data</td><td>
but that returns
<tr><td>some data</td><td>
I built a test case for you to show the issue.
https://live.datatables.net/taxareri/2/edit
It shows the missing
className
if the row is not added to the current page. But the row is displayed on the page.I also noticed a bit different behavior with DOM sourced table. The added rows aren't displayed on the page. It requires calling
draw()
to add the rows to the page. The row on the current page displays theclassName
but the row not on the page still does not.https://live.datatables.net/taxareri/3/edit
I added the
draw
event to both test cases. It seems the ajax loaded test case there is a call todraw()
at some point after the rows are added. Not sure what is triggering thisdraw()
call.@allan will need to take a look.
Kevin
Thanks, kthorngren !!!
https://live.datatables.net/taxareri/2/edit case
when add current page, it's return wanted value.