Okay
  Public Ticket #3267399
Link to a joined table
Closed

Comments

  • Peter started the conversation

    Good day, 
    Thank you for allowing me to tell you about my problem. 
    I am currently creating a website for the bowling association on my test server. I have created a mysql-database query of the players 
    https://www.passt.it/kunden/iskv/spieler-copy/. 
    On this query I joined also two other tables (team=Mannschaft and league=Kreis).
    How can I create a link to the respective team (Mannschaft) where will be listed all players of this team? 
    Thank you very much!
    Peter

  •  1,849
    Miloš replied

    Hi, Peter.

    Sorry for the delay.

    I am not sure i understood exactly what you're trying to do, in terms of these links.

    But i will share some informations on how you can generally make links on cells of our tables,

    and also how you can use CONCAT if you need to make "dynamic/ merged links" by combining data from multiple columns from SQL to one custom column.


    1. If you use our URL type columns:

    “URL link” columns are used to render hyperlinks that can be clicked to open pages within your website, or in external websites.

    • Rendering rules: If the content of the cells contains a combination of “two sticks” – || – everything to the left of this combination is used as an URL address for the link, and everything to the right as displayed text. For example:
    https://wpdatatables.com||Check out wpDataTables



    will be rendered as:
    Check out wpDataTables
    If the “||” combination is not found in the content, the entire content will be used both for the link and as the display value.


    If you need it to look as a button, you can set "Show link as a button" in column settings.

    You can also add custom styling to the button, if you wish.

    First, you need to add a custom class to it:

    4698826991.png

    Then, visit this website, generate your button, and click on "Get Code":

    6639315205.png

    In the right part of the screen, you'll see the code you need for this button:

    9848024905.png

    Copy the code without the first row and change "myButton" to the custom class you added in step 1, so instead of this:

    .myButton {
        background-color:#51d1c6;
        border-radius:28px;
        border:1px solid #1995ab;
        display:inline-block;
        cursor:pointer;
        color:#ffffff;
        font-family:Arial;
        font-size:17px;
        padding:16px 31px;
        text-decoration:none;
        text-shadow:0px 1px 0px #2f6627;
    }
    .myButton:hover {
        background-color:#5a9615;
    }
    .myButton:active {
        position:relative;
        top:1px;
    }

    You would use this:

    .customclass {
        background-color:#51d1c6;
        border-radius:28px;
        border:1px solid #1995ab;
        display:inline-block;
        cursor:pointer;
        color:#ffffff;
        font-family:Arial;
        font-size:17px;
        padding:16px 31px;
        text-decoration:none;
        text-shadow:0px 1px 0px #2f6627;
    }
    .customclass:hover {
        background-color:#5a9615;
    }
    .customclass:active {
        position:relative;
        top:1px;
    }

    In the table, go to Customize/Custom CSS and paste that code:

    5662287483.png

    Notice that the font color had to include the !important clause to override the color of the text in the button. After you add this, the button in the table will look like this:

    4803006689.png

    2.

    Or, if you wish to use a string-type column ( This is more useful if you  need multiple links in same cell):

    If you use a one line string, it will be limited to 255 characters; 

     if you use multi line string - it will have 65,535 character limit.

    Please check out this documentation about our text fields;

    The cells will render HTML, so you can wrap links in anchor tags, for example,

    <a href="https://www.w3schools.com">Visit W3Schools.com!</a>
    

    this would render in cell as "Visit W3Schools.com!"  as the displayed text, but it will  lead to the link when clicked;

    and the other regular text fields will simply be rendered as text;

    -

    You can also style it, if you add an ID, or a class in my example :

    <a href="yourURL" class="customButton">Link Text</a>

    You can then add some custom CSS styles to the table, in Customise tab > Custom CSS;

    On my example i will make it look like a green button:

    .customButton {
      background-color: #4CAF50;
      border: none; 
     color: white; 
     padding: 15px 32px; 
     text-align: center; 
     text-decoration: none; 
     display: inline-block; 
     font-size: 16px; 
     margin: 4px 2px;
      cursor: pointer;
    }
    

    and it would look like this :

    6674728901.png

    -


    3. If you meant to create a dynamic custom URL column that combines/merges data from multiple columns/tables,  then you can use SQL CONCAT solution.

    Please check our example how to do that with our tables here : 

    I hope this helps.

    If you wanted something completely different, please elaborate, and we can help. Thanks.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    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

  • Peter replied

    Hello Milos, Thank you for your answer! Your answer showed me some possibilities, but I need your help again.
    I have several tables in my SQL database: 

    Players = iskv_spieler
    Teams = iskv_mannschaften
    Games = iskv_spiele
    League = iskv_MannKategorien
    and others. 

    This data is imported into the database by the bowling association.

    I have now created a table with the next games. There the games are listed on with date, the home team, the guest team and the league. I would now like to include a link on the home or guest team, where a table will be displayed with all players of this team. On the players than I would like to include another link to get to the details of the player (player no., photo, highscore etc.). This means that I would have to include the links within the different tables. How can I do this?
    I just joined the tables!

    Many thanks and best regards
    Peter

    Attached files:  games.png
      sql-queryy.png
      tables.png

  •  1,849
    Miloš replied

    Hi, Peter.

    Thank you for clarifyin the goal, i think i understand what is needed for the next step.

    And i just wanted to comment, i see that you made SQL JOINs to join data/ make relations for columns from multiple tables;

    you can also try our Foreign Key relation feature for that - it might be useful to try and see if that is easier for you.

    Basically, the main benefit is that you can make the table Editable with a Single value selectbox,

    and with SQL JOIN functions, the table will not be editable - so i guess it depends if you need editing the most.


    2. In regards to setting up a  "more details about players", where a user can click into a row for each player,

    and get to a page that loads details for this player;

    i think you should try our Master Detail add-on,   with that you can choose to make a "more Details" section,

    and you can choose the action "On row click" for example,

    you can also choose which columns will be included there, like player no., photo, highscore etc;

    and if you wish you also can make a template page with placeholders that will pass details for this player.

    Please check out more details with an example about Master Details here.

    Before purchase, you can test the Add-on features on our sandbox site.

    Let me know if that helps.


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    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