Hi, Is there a way to dynamically disable responsive on a button click ?
Hi, Is there a way to dynamically disable responsive on a button click ?
praveenb
Posts: 10Questions: 2Answers: 0
Hi, Is there a way to dynamically disable responsive on a button click ? I'm enabling responsive using constructor. Is there a way to disable it dynamically ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
No, it's an initialisation option without an API method to then disable it. The only thing you could do is to
destroy()
the table on the click of that button and initialise again without theresponsive
set,Colin
Thanks. I also noticed that using the responsive constructor in initComplete doesn't work for ajax data. The icon shows up but clicking on it doesn't show the child row. Is there any way to make this work ?
table = $("#example").DataTable({
destroy: true,
"ajax": {"url": url, "dataSrc": ""}
"initComplete": function (settings, json) {
new $.fn.dataTable.Responsive(table);
},
})
I'm not sure why that wouldn't work, but can you just use
responsive: true
as in this example: http://live.datatables.net/voruhuwo/1/edit ?Colin
I can't use
responsive: true
because just before adding responsive I'm reordering the columns by getting order from database. Usingresponsive: true
doesn't show the table correctly after reordering. Please let me know if there is any other way to do this.I don't believe the
table
variable is assigned and ready to use insideinitComplete
. You can usethis.api()
to get an instance of the API. For example:Kevin
Thanks Kevin.
this.api
worked perfectly.