Thread Starter
raugul
(@raugul)
And also when using accordions
Thread Starter
raugul
(@raugul)
Can you help me finish writing javascript?
I read this topic:
https://ww.wp.xz.cn/support/topic/responsive-table-in-accordion/
I realized that it doesn’t work, but I really need it to work
Can you tell me to add some javascript code?
Thread Starter
raugul
(@raugul)
After I click, sort the column, the table performs a collapse
Can you help me do this automatically?
Automatically enable sorting, while opening the spoiler, tab, or accordion
Hi,
thanks for your post, and sorry for the trouble.
Your findings are correct. Unfortunately, the collapse mode does not work nicely in tables that are added inside tabs, spoilers, or accordions.
Unfortunately, I’m not aware of easy ways to make that work.
You would need to add some custom JavaScript code, depending on the exact JS code for the tabs/accordions.
Regards,
Tobias
Thread Starter
raugul
(@raugul)
After opening the tab, and scrolling a little bit of the page, the table becomes collapse
That is, with minimal scrolling of the site, the width of the open tab is recalculated
It turns out that you need to add js code to recalculate the width of the container in the tab when opening it?
Can you tell me what code to add to the plugin’s Js so that when it appears, it recalculates the width of the container?
Or to have the table automatically sort by column?
Or was the search input field activated?
If you do any of this, thousands of people will be insanely grateful to you
Please help me
Thread Starter
raugul
(@raugul)
I’ve retested all possible plugins for tabs, accordions, and spoilers
Nothing helped
Thread Starter
raugul
(@raugul)
Please, no one else can help, the only hope is for you Tobias
Hi,
unfortunately, I don’t have an automatic solution here, sorry. You will need to call an API function (probably draw()) of the external DataTables JavaScript library, in a JavaScript event that is triggered by your accordion/tabs plugin.
Regards,
Tobias
Thread Starter
raugul
(@raugul)
The guys from DataTables sent this link:
https://datatables.net/examples/api/tabs_and_scrolling.html
Can you help me figure this out?
Thread Starter
raugul
(@raugul)
I understand I need to call this:
var table = $(‘#example’).DataTable();
$(‘#container’).css( ‘display’, ‘block’ );
table.columns.adjust().draw();
But how?
Hi,
that depends on your specific tabs/accordion plugin, and whether it offers JavaScript events.
Then, you could integrate this as a custom solution.
Unfortunately, it’s not possible to directly do this in TablePress.
Regards,
Tobias
Thread Starter
raugul
(@raugul)
I use default Elementor tabs
If it helps, of course.
-
This reply was modified 5 years, 2 months ago by
raugul.
Hi,
I don’t have experience with Elementor or other such plugins, sorry.
I can really only suggest that you try to find some custom solution here, where you integrate DataTables with custom code, i.e. so that TablePress only delivers the HTML code for the table, but the other features are added with that custom code. That way, you have full control over it, and can integrate it with such tabs.
Regards,
Tobias
Thread Starter
raugul
(@raugul)
I solved the problem thank you
<script>
jQuery(function($) {
$(“.elementor-tab-title”).on(“click”, function(){
tabTitle = $(this);
setTimeout(reDrawAdaptiveCustom(tabTitle), 2000);
});
function reDrawAdaptiveCustom(tabTitle){
var table = tabTitle.closest(‘.elementor-toggle-item’).find(‘.tablepress’).DataTable();
table.columns.adjust().draw();
}
});
</script>
Hi,
very nice! Thanks for sharing that solution!
Best wishes,
Tobias