.node() is undefined
.node() is undefined
apancu
Posts: 6Questions: 0Answers: 0
When DT2 render function is called with type == 'display' the node() is undefined. Is this by design? It makes it difficult to access the DOM for the current cell. In DT1 it was available. deferRender is set to false.
Replies
Can you post your code snippet so we can see what you are trying to do?
The
columns.render
docs state this:It is intended to operate on the data not the DOM node.
createdRow
,rowCallback
andcolumns.createdCell
are the expected functions to access and alter the DOM node. Possibly you can use one of those callbacks instead.Kevin
I'm sure there was another thread on this topic recently, but can I find it now... Not a chance!
No - I don't recall intentionally making that change, but it probably happened due to changes in this area. As Kevin notes, it isn't really expected that you would get the node in a rendering function, and you certainly wouldn't want to use the API to get it due to the overhead.
A test case would be really useful.
Allan
Thanks for the quick responses. Yes, that was me in another discussion here:
https://datatables.net/forums/discussion/comment/231353#Comment_231353
I am currently trying to use createdRow instead. I need to conditionally set a class on a cell based on it's data and the column definition. The table data is server side and reloaded every second.
Ah yes, and in the PM - apologies I lost track of that. Too much going on .
I've created this little example to show the issue.
columns.createdCell
might be your best option. Example here: https://live.datatables.net/kacufezo/1/edit .That will be far more performant than using the API in the rendering function.
Allan
Awesome! Thanks again, Allan. I will try that at once.
Thanks,
Andrei