How to correctly refresh datatables and submit additional variables at the same time

How to correctly refresh datatables and submit additional variables at the same time

maykinomaykino Posts: 10Questions: 2Answers: 0

Hi, this is how I run my instance of datatables:

    datatables = $('#data-table').dataTable({
        "aaSorting": [[1, "desc"]],
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "aoColumnDefs": [{"bSortable": false, "aTargets": [0, 1, 2, 3, 4, 5]}],
        "bProcessing": true,
        "bServerSide": true,
        "sDom": 'l<"toolbar">fr<"clear"><"clear">tip',
        "sAjaxSource": "billing_mcafee/show_billing_json",
        "fnRowCallback": function(nRow, aData, iDisplayIndex) {
            if (!(selected.indexOf(nRow.id) === -1)) {
                $('td:eq(0)', nRow).html('<a class="icon-check fa-icon fa-checkbox"></a>');
            } else {
                $('td:eq(0)', nRow).html('<a class="icon-check-empty fa-icon fa-checkbox"></a>');
            }
        },
        "fnCreatedRow": function(nRow, aData, iDataIndex) {
            $(nRow).attr('id', aData[3]);
        },
    });

Then I need to refresh it and submit additional variables like this one:

$('input[type=radio]').on('ifClicked', function(event) {
datatables._fnServerParams.push( {"name": "filter_type", "value": $("input:checked").val()});
datatables._fnAjaxUpdate();
});

but this one of course doesn't work.

This discussion has been closed.