One search bar for multiple tables

One search bar for multiple tables

DanjmDanjm Posts: 4Questions: 3Answers: 0

Hello,
I've been using datatables to display scraped game data on my project, and am displaying three different tables on the same webpage. As you'd imagine each table has it's own search bar, "show 10 entries" button etc. as part of the datatables framework.
I was wondering what the best way of having a single search bar which I created and button that works on the three tables was. Knowing which functions run the search script when the user types in the search bar would work I imagine but I can't seem to find them.
Thank you very much, i'm open to any method of approaching this I just don't have much experience with Javascript yet, but i'm trying to learn

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 12,948Questions: 0Answers: 2,206
    Answer ✓

    Hi Danjm,

    Yep, easily done with DataTables - please take a look at this example here!

    Cheers,

    Colin

  • DanjmDanjm Posts: 4Questions: 3Answers: 0

    Thank you so much for the quick response Colin, it was exactly what i'd been looking for. I do have one question though, how does this line work?

    "dom": '<"top"i>rt<"bottom"><"clear">'

    I quite like how it gets rid of the numbers at the bottom and the show x entries at the top, but is there a way to keep the navigation buttons which show the next 10 entries so users can still navigate the tables?

    Cheers

  • colincolin Posts: 12,948Questions: 0Answers: 2,206
    Answer ✓

    You're welcome, and yep, if you visit that link again, you'll see the page control is back! The dom allows you to configure the look of table's elements.

    C

This discussion has been closed.