Okay
  Public Ticket #2584068
Using Table Data as Variables for Pre-filtering tables through URL
Closed

Comments

  • Tom Hoffman started the conversation

    Hello,

    I'd like to present my users with a list of items in table format.  Say, Apple, Orange, and Pear.  The table would contain their names and basic data, like price.  This would all be pulled from a SQL database.  I can do this without an issue and your product is awesome.

    I'm wondering, however, if it possible to make the item names, like Apple, a hyperlink that will then pull up a pre-filtered table through URL, using the table data as the filter.  In this case, it would be the item name, Apple.  That second page will have a number of tables I'd like filtered to only view data about the Apple, or whatever they item they had clicked.

    I'm wondering if this is possible with your product and if you have any examples on how to do it?  I couldn't find anything in the support docs.  And if filtering through URL isn't the smart way to do it and another exists, please let me know.

    Thanks!

    Tom

  •  2,572
    Aleksandar replied

    Hello Tom

    Thank you for your purchase.

    Since you're using SQL query to create a table, you would be able to do it with a CONCAT function.

    So, supposedly you have your website www.somewebsite.com, and you have a separate page for "Apple": www.somewebsite.com/apple/. To make the items in a specific column hyperlinks, you need to do it like this:

    SELECT  CONCAT('<a href="https://www.somewebsite.com/',yourTable.itemColumn,'/">',yourTable.itemColumn,'</a>') AS Item,
            name,
            price
    FROM yourTable

    So, that would actually create an anchor tag around "Apple", like:

    <a href="https://www.somewebsite.com/Apple/">Apple</a>

    But it would pull that data dynamically from column's cells.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables