Tabbutton serverside ajax request not working after second time

Tabbutton serverside ajax request not working after second time

FiezDevFiezDev Posts: 5Questions: 3Answers: 0
edited December 2022 in Free community support

I made a table with tabs that send an AJAX request to the server-side.
Each tab queries the same table, but with different columns and filters.
However, when I click on a tab, it works the first time, but after the second click,
the tbody of the table disappears and the AJAX requests is not send.
I want to know how to fix this issue so that I can click on the tabs back and forth without any problems.

Example Code That i use in tab.

    $('#tabAll').on('click', function () {
        currenttab = 'tab_all';
        pageConfig = tabConfig_all;
        table.clear().destroy();
        $('#example').empty();
        $('#example').DataTable({
            columns: pageConfig.columns_Config,
            ajax: {
                url: pageConfig.ajax_url,
                data: pageConfig.ajax_data
            },
            columnDefs: pageConfig.columnDefs_Config}
        );
    });

Test Case:
http://live.datatables.net/kemexone/1/edit

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.