Can you manually trigger processing.dt?

Can you manually trigger processing.dt?

crwdzrcrwdzr Posts: 31Questions: 5Answers: 6
edited October 2017 in Free community support

Events are something I haven't really used before in javascript except when listening for them being fired. Is it possible to manually trigger a datatable event?

I tried using $('#table').trigger('processing') and $('#table').trigger('processing.dt') on my datatable but neither of them work. $('#table').on('processing.dt',function(){. . .}) works without issue when datatables fires the event on its own.

I'm asking because in a few spots in my application it would be nice to emulate the same response that the listener for 'processing.dt' evokes. If this is not the 'proper' or 'suggested' way to do things it is no issue to just break the desired response out of the listener's callback function and call it as its own named function, but this is just something that peaked my interest

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Try using this plug-in method.

    Having siad that, $('#table').trigger('processing.dt') should work - that is basically what DataTables does itself.

    Allan

  • crwdzrcrwdzr Posts: 31Questions: 5Answers: 6

    ahh, I see what I was doing wrong. It was triggering it but I was always expecting it to evaluate the if (processing) then {...] bit of code which will fail if manually triggered.

    I think I'll just make the {...} there its own function and call it instead of trying to fiddle with triggering the processing event. Thanks for the response

This discussion has been closed.