Obtaining API reference from within render function
Obtaining API reference from within render function
pimlottc
Posts: 4Questions: 1Answers: 0
The documentation for column.render
, in the section for using a render function, describes the meta
parameter and says:
settings
- The DataTables settings object for the table in question. This can be used to obtain an API instance if required.
but I've been searching through meta.settings
and I can't seem to find it. There's a meta.settings.oApi
, but that's not it. What am I missing?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use
new $.fn.dataTable.Api( meta.settings )
to create a new API instance from the settings object.Allan
Ah ha, perfect, thanks!
Perhaps you could update the docs to be more explicit (the
column.data
page mentions this as well). Even now, after having read the first section of the API page where it mentionsnew $.fn.dataTable.Api( selector )
, it's not clear thatmeta.settings
could be used as an "api-selector" (or maybe it's a table-selector?)Agreed! I've sort of tried to avoid referencing the settings object too much as I don't want people using it. But yes, I think it is important here.
Allan