Multiple tables with same data but different search filters set on each table

Multiple tables with same data but different search filters set on each table

harmenzonharmenzon Posts: 17Questions: 7Answers: 0

I have six tables on my website. They all use the same data set. Therefore I used the Multiple Tables Example. Which works great.

But now I would like to use different search filters for each table. How can I achieve this?

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @harmenzon ,

    You can either initialise them all individually, by table's ID or some other unique selector, or you could group them with classes and initialise each group.

    Cheers,

    Colin

  • harmenzonharmenzon Posts: 17Questions: 7Answers: 0
    edited October 2018

    Thank you for the quick reply @colin . The six tables all got there own ID. And the six tables all got a class name. The initialisation by the class name is going fine. So the six tables are loaded with exactly the same data. So far so good.

    Now I would like to, for example, hide column A in table 1 and hide column B in table 2, etc. How can I achieve this? Do you have a some example code on how to do this?

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    As Colin mentioned you would access them using a unique selector. Maybe this doc will help:
    https://datatables.net/manual/api

    Kevin

  • harmenzonharmenzon Posts: 17Questions: 7Answers: 0
    edited October 2018

    Strange. That's what I am trying to do, but somehow it is not 'drawing' my 'search'. Must be doing something wrong cause the search worked on many of my datatables before. I will investigate further.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    If you could link to your page, or create a test case, we're happy to take a look. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • harmenzonharmenzon Posts: 17Questions: 7Answers: 0
    edited October 2018

    Thanks @colin. While trying to create a test case, I have found why it was not working. Since I wanted to hide all control items, I had coded "searching": false. Removing that piece of code fixed my problem. So it was that simple. And I am hinding te control elements now using the dom. So all good. Thanks for the help @colin and @kthorngren

This discussion has been closed.