Okay
  Public Ticket #1988044
foreign key
Closed

Comments

  • HPPraxis started the conversation

    I want to build a students gradebook.
    To test the functionality of wp datatables I created two tables:

    Table 1 basic data:  name, class, firdt name, mail
    Table 2 grades: name, form, mark1...

    I want to get the data "name" and "class" from table 1 into table 2 by connecting the colums but it doesn´t work. I followed your instruction guide and your video of using foreign key (I tried the example - ok).

    Why do I fail? Did I get something wrong?
    Do you have more ressources and examples of combining tables?


  •  2,572
    Aleksandar replied

    Hey HPPraxis.

    Thank you for your purchase.

    Do you have a unique ID for each row? As you had the chance to see in our documentation, it is being used as a store value.

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.

    Best regards.

    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

  •   HPPraxis replied privately
  •   HPPraxis replied privately
  •   HPPraxis replied privately
  •  2,572
    Aleksandar replied

    Hello HPPraxis.

    I don't believe it's a good practice to use the wdt_ID column for Foreign keys.

    Please take a look at the attached screenshots. You can see that the last two in [wpdatatable id=24] don't match up with [wpdatatable id=19].

    If you enable editing for a column configured as a foreign key and you choose a single-value selectbox as an editor input type, editing will work naturally, and the IDs will be stored in the column.

    Unfortunately, wdt_ID is a unique auto-increment integer column, and therefore cannot  be used properly for a foreign key, since upon each new row it is adding a new value, and even if you pass the correct data for other columns it will not be recognized as a store value column, until (like you said) you add it manually.

    Best regards.

    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