Question about ID and VAR for multiple tables with Yadcf

Question about ID and VAR for multiple tables with Yadcf

lenamtllenamtl Posts: 265Questions: 65Answers: 1

I have a page with several datatables tables
I'm using the same var for each, only the ID is different.

var table = $('#list1').DataTable();
var table = $('#list2').DataTable();

First is it good to do that or I should use different var for each table?
If there are no problem to use the same var, how can I init Yadcf the the ID instead of the var?

Now I'm using
yadcf.init(table, [],);
and I'd like to init using ID instead of the var

could you provide the good syntax if possible

Thanks

This question has an accepted answers - jump to answer

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    Hi,

    You have to provide the DT object for yadcf,

    You can init yadcf like this: yadcf.init($('#list1').DataTable(), []);

  • lenamtllenamtl Posts: 265Questions: 65Answers: 1
    edited January 2017

    Hi,
    I have removed the var table = and use your syntax
    This seems to work ok for now except for filter reset because table does not exist anymore...

    $("#filter_reset").click(function() {
    yadcf.exResetAllFilters(table);
    });

    Is there a way to still use var table = with the syntax you proposed
    just in case it's break somethings with datatables or it's plugins?

    Or should I stick with my previous with var= and give a different var to each table?

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Answer ✓

    Give a different var to each...

  • lenamtllenamtl Posts: 265Questions: 65Answers: 1

    Ok thanks

  • lenamtllenamtl Posts: 265Questions: 65Answers: 1
    edited January 2017

    ```

This discussion has been closed.