how to add column filter dynamically

how to add column filter dynamically

sabsab Posts: 1Questions: 1Answers: 0

I have multiple tables on my html page.. and I initialise datatables using the

$('.tables').dataTable();

And I have different column filter for each table which I set up later in another call. OR on a button click. So I am doing the following

$('#tables-list').dataTable().columnFilter(
    { aoColumns: [
        { type: "text"},
        { type: "select"},
        null,
        null,
        { type: "select"} 

    ]}
);

But I get error that cannot reinitialise datatables. I dont want to use variable / handle while initializing tables as it becomes difficult to manage.

This discussion has been closed.