responsive.recalc() undefined
responsive.recalc() undefined
Hi,
first of all thanks for an awesome plugin :) I'm currently working on a website built with bootstrap and for tables I'm using the responsive extension (all latest versions).
So my problem occurs because I have some tables in tabs, which are hidden on datatable init, so the layout is broken on show. So to correct this I tried using responsive.recalc() like it says in the reference, but nothing happens and if I debug the code, it says that the function is undefined.
My code:
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('.data-table:visible').each( function(e) {
$(this).DataTable().columns.adjust().responsive.recalc();
}) })
DataTables debug if needed - http://debug.datatables.net/aceley
What am I doing wrong?
Thank you for any help.
This question has an accepted answers - jump to answer
Answers
Could you try responsive.recalc() without columns.adjust() and see if it works?
Tried it, no difference, it's still undefined. I also tried 1.0.2-dev version and it also doesn't work.
Please link to a test case showing the issue. Here is a trivial test case which shows it working: http://live.datatables.net/walocode/1/edit .
Allan
Hey allan,
I've made a quick mock up here - http://live.datatables.net/rerimoxo/1/edit
So on the page load, the table in tab 2 has those expand buttons, despite not having any hidden columns. If you then resize the window until the responsive is actually needed and then back, it fixes it self.
The tab shown event is definitely triggering and table selector is working (id in alert).
Any ideas?
Super - thanks for the test case. That look very much like a bug to me.
Allan
I've just committed a fix for this and the test case is working now. Thanks for that!
Allan
Oh wow, thanks for a quick fix allan :) That fixed the problem.