Table load / refresh event

I need to trigger a function on a table refresh (user clicks the table header to sort by column)
currently I’m using .on to listen for a click event anywhere in the table.

// Hide edit column after refresh or sort
$(document).on('click', '.table', function() {

This requires the use of a timeout which gives different results depending on the users internet connection.
I’ve tried replacing ‘click’ with ‘load’ but that doesn’t fire. I’m wondering if there is an existing function similar to TB.render that I can use or simply a better method to catch the table load/refresh?

@Marty Have you check like this ?

$(document).on('table-render-start.'+dataTableID, function(e) {

Thanks for this. I do catch this event, although it still seems to require a setTimeout to hide the components (but a much shorter one) Are you aware of a similar event, that fires after render is complete, maybe like table-render-end? I tried a few variations but none of those worked and google wasn’t much help either.

No, you have to use setTimeout because render data and print on page take small time and there is no end event possible yet.

1 Like