Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #3432920
Parent-Child relationship
Closed

Comments

  • Alex started the conversation

    Hello,

    I have the following scenario:

    I have a person table. A person can be a parent for another person (1 to many relation: meaning 1 person can have only 1 parent, 1 parent can have many children). The table has a column called 'Name' that is unique.

    I would like to have another column in the same table that is named 'Parent'. This column should have a drop down list with all the names in this table.
    Is this possible using wpDataTables?

    Thanks!

  •  1,847
    Miloš replied

    Hi Alex,

    i did not fully understand all the details of this use case, and what functionality is expected from our Plugin.

     For example, if you mean to make a "one to many" foreign key relation with our Plugin,

    at the moment, that is not possible.

    We do have a foreign key relation column feature ( please check more on it here),

    but it it limited to just one-to-one relation, so each value needs to be unique coming from the remote table.

    You can have editing of Foreign Key Column(s) with a single value selectbox.

    -

    So, for example if the Column "Name" is in the child Table, 

     you can make the foreign Key relation "Parent" column

    that pulls values from a remote table for "Parents".

    Then the editing will be possible as unique values for the parent from the other table.

    I hope that makes sense, let me know if that can work for your use case.

    Thank you.

    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

  • Alex replied

    Hi Milos,

    Thank you for your reply,

    The thing is that in my case there is not a separate table "Parent" and "Child". There is only one table "People" that contains a column "Name" and another column "Parent". Can my column "Parent" be a drop down list with every name in the column "Name" of the same table?


    Thank you,

    Best regrads,

    Alex

  •  1,847
    Miloš replied


    Hi Alex,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    I am sorry, i thought you had two tables and are making a foreign key relation on them;

    But now i can see what you mean.

    If you want to have all this in one Table,

    and add a new Column - which is going to pull all the available values that another column has;

    That is not possible;

    You will have two possible workarounds for this :

    1. You can make a separate table which will hold all possible values for the names you need,

    and then make a foreign key relation to pull values for editing from there;

    ( please check our example how this works here)


    2. Or, you can manually add values which will be available for editing checkbox,

    like this :

    In the Column Data tab, set Possible values for column  to Define Values List,

    then manually add values available for editing in the dropdown :

    2030131373.png

    At the moment, that is the only way,

    because in order for the foreign Key Column to pull available values from another Column,

    that Foreign Table needs to have a unique row ID column of its own ( for example in the Parents Table it can be called "ParentID" , or just "ID",

    but in this table,  it also has to have another "row ID", if that makes sense - for our Manual tables we automatically add column named "wdt_ID" which is a primary unique auto increment integer, for Editing);

    ,

    so each name value has a unique ID,  in order to be pulled,

    while this editing table you are using also needs to have it's own unique Table row ID.

    Let me know if anything is unclear.

    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