Obtain the DT API instance from initComplete.

Obtain the DT API instance from initComplete.

washuit-iammwashuit-iamm Posts: 133Questions: 55Answers: 2
edited February 2019 in DataTables 1.10

Is this right?

initComplete: function (settings, json) {
    var self = this.api();
}

Or do I need to go from settings?

initComplete: function (settings, json) {
    var table = settings.oInstance.api();
}

Difference?

(settings.oInstance.api() == this.api()); // FALSE!!!!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @washuit-iamm ,

    Yep, use the top one, see example here. As the manual says for DataTables.Settings, the settings "object is considered to be private in terms of the DataTables API and reading or writing to the values in the object is not supported."

    Cheers,

    Colin

This discussion has been closed.