Responsive - Issue with event "responsive-display"
Responsive - Issue with event "responsive-display"
jteutenberg
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
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
Why is the event "responsive-display" triggered on resize and page change, but not on init? Is it possible to change that?
Same concerns the event "childRow".
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$()".
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
It is working. Thanks.