datatables change aocolumndefs parameters onclick

datatables change aocolumndefs parameters onclick

makavelimakaveli Posts: 1Questions: 1Answers: 0
edited May 2017 in Free community support

Hi, i want to change the parameters of "aoColumnDefs" ( "aTargets"), onClick.

$(document).ready(function() {
$(document).on('change', "#dropdownOptio", function(){
    table.aoColumnDefs.push({"bSearchable": false, "aTargets": [1] });

} );

    // DataTable
    var table = $('#example').DataTable( {

        "pageLength": 45,
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ],

         "aoColumnDefs": [

            {
                "bSearchable": false,
                "aTargets": []

            }

             ]

    } );

} );

i had some idea but this doesn't work. Can someone please help me out.

Thanks

This discussion has been closed.