Fire Event After The Responsive Plugin is Done

Fire Event After The Responsive Plugin is Done

zepernickzepernick Posts: 32Questions: 7Answers: 0

Is there an event I can listen to that would fire after the responsive plugin is done running? I want to be able to see what columns are showing and which have collapsed. There is an array that holds that information here: settings._responsive.s.current, but the _responsive property is not yet attached when listening on the column-sizing.dt event.

This question has an accepted answers - jump to answer

Answers

  • zepernickzepernick Posts: 32Questions: 7Answers: 0

    I have been digging through the source and it looks like the best place to trigger an event would be in the resize() method in the responsive plugin IF the redrawChildren is called.

    I will submit a pull request once I verify that it is working. Hopeful that this will be useful to the project and accepted.

  • allanallan Posts: 61,896Questions: 1Answers: 10,146 Site admin
    Answer ✓

    Hi,

    Currently no - there isn't, however I can see that it would be useful. The section of code you have located is the correct place to put such an event.

    One thing - I would suggest being really careful with the internal settings object. It can, will and does change between versions. Perhaps Responsive should have an API method which gives this information (i.e. which columns are collapsed).

    Happy to take a PR or put it in.

    Allan

  • zepernickzepernick Posts: 32Questions: 7Answers: 0

    Thanks Allan, I have submitted a PR here https://github.com/DataTables/Responsive/pull/60

This discussion has been closed.