Hook into attachment of TRs to table body

Hook into attachment of TRs to table body

TheVictorTheVictor Posts: 1Questions: 1Answers: 0

Hi,

First of all, thank you so much for the most flexible datagrid in existence! :smile:
My issue in a nutshell is as follows: I'm using the createdCell callback to compile and link my own angular elements. However, I should only link them once they are actually attached to the DOM, otherwise some features like Angular's data validation obviously can't work as the fields are not attached to the form, which contains the DataTables table.

To solve this I would need a callback that is fired once the cells are attached to the table, just before rendering. I tried createdRow, but it's not yet attached to the table at that stage either. Is there an existing callback I can use for this purpose? I'd like to avoid the draw callback as that seems overkill to me - I only need to run my code when a row is attached to the DOM after creating the cells. Even better if multiple row's are attached together so that my code can be run once per each new page visit / reorder / etc, whenever new cells are created.

Many Thanks,
Viktor

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    You'd need to use drawCallback or draw. The rowCallback option is available, but the elements aren't actually in the document at that point - they are put into a document fragment for speed.

    Allan

This discussion has been closed.