Parent / child table
Parent / child table
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
There are two PHP scripts used for that blog post:
The child table, in the blog post, is created by the
createChild
function which builds a DataTable with aajax
option to query the child PHP script. This is the relevant part of the blog post.Allan
ci provo, grazie !!