Parent / child table

Parent / child table

Diego1966Diego1966 Posts: 20Questions: 4Answers: 0
edited March 26 in Free community support

Good evening everyone, I wanted to ask for information when reading this post: https://datatables.net/blog/2019/parent-child-editing-in-child-rows
I wanted to understand how to implement the query of the child table in php, that is, the QUERY SELECT must have the WHERE clause table1.Id1=table2.Id1 or even any JOINs or otherwise just a SELECT FROM Table2 and then this function is enough

Editor::inst( $db, 'sites' )
     ->fields(
         Field::inst( 'id' )->set( false ),
         Field::inst( 'name' )->validator( 'Validate::notEmpty' )
     )
     ->join(
         Mjoin::inst( 'users' )
             ->link( 'sites.id', 'users.site' )
             ->fields(
                 Field::inst( 'id' )
             )
     )
     ->process( $_POST )
     ->json();

do you get the child rows?

sorry but I just started and I still have to understand how to work with DataTables

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    There are two PHP scripts used for that blog post:

    1. The parent table
    2. The child tables.

    The child table, in the blog post, is created by the createChild function which builds a DataTable with a ajax option to query the child PHP script. This is the relevant part of the blog post.

    Allan

  • Diego1966Diego1966 Posts: 20Questions: 4Answers: 0

    ci provo, grazie !!

Sign In or Register to comment.