Obtaining API reference from within render function

Obtaining API reference from within render function

pimlottcpimlottc 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

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Use new $.fn.dataTable.Api( meta.settings ) to create a new API instance from the settings object.

    Allan

  • pimlottcpimlottc Posts: 4Questions: 1Answers: 0
    edited October 2014

    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 mentions new $.fn.dataTable.Api( selector ), it's not clear that meta.settings could be used as an "api-selector" (or maybe it's a table-selector?)

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    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

This discussion has been closed.