Responsive - Issue with event "responsive-display"

Responsive - Issue with event "responsive-display"

jteutenbergjteutenberg Posts: 16Questions: 3Answers: 0

Link to test case: http://live.datatables.net/xuxowawe/1/edit?html,js,console,output

I try to use the event "responsive-display" to remove some DOM elements.
Unfortunately the event is triggered only if the view switches between desktop and mobile. If I use the mobile view directly this event isn't triggered.

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    It would be better to use column.visible() to hide the column, rather than removing the node, as that's likely to have side-effects (as you can see when you go from portrait to landscape).

    Regarding the main issue, you could add that event handler code into initComplete, as that would be called when the table is first initialised.

    Colin

  • jteutenbergjteutenberg Posts: 16Questions: 3Answers: 0

    Why is the event "responsive-display" triggered on resize and page change, but not on init? Is it possible to change that?

  • jteutenbergjteutenberg Posts: 16Questions: 3Answers: 0

    Same concerns the event "childRow".

  • jteutenbergjteutenberg Posts: 16Questions: 3Answers: 0

    How can I see/address the child rows in "initComplete"? I can see/adress only the "normal" rows with "api.rows({ page: 'current' }).nodes().to$()".

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    but not on init? Is it possible to change that?

    Initialize the event before initializing Datatables, like this:
    http://live.datatables.net/xuxowawe/2/edit

    Note that responsive-display.dt is used. See the Events Dcos for details of how .dt works.

    Kevin

  • jteutenbergjteutenberg Posts: 16Questions: 3Answers: 0

    It is working. Thanks.

Sign In or Register to comment.