Hi, I guess this will be just something I am missing, so here is the code I have and is not working.... Very same example when using this code without aliases and multiple tables is working. I had 1 table which used alias as well (no joins), once I removed the alias from everywhere the delete works afterwards. The debug information is completely empty {"data":[],"debugSql":[]}
editor3 = new $.fn.dataTable.Editor( {
ajax: "_content/datatables/dt_email_groups_assign.php",
table: "#emailsgroups",
fields: [ {
label: "Email:",
name: "eg.emailaddress_id",
type:"select"
}, {
label: "Group:",
name: "eg.emailgroup_id",
type:"select"
}
]
} );
table3 = $('#emailsgroups').DataTable( {
dom: "Bfrtip",
ajax: "_content/datatables/dt_email_groups_assign.php",
columns: [
{ data: "e.address" },
{ data: "g.name" }
],
select: true,
buttons: [
{ extend: "create", editor: editor3 },
{ extend: "edit", editor: editor3 },
{ extend: "remove", editor: editor3 }
],
} );
PHP part below
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'fmsmon.mon_emails_cfg'.$_SESSION['dblink'].' eg', array('eg.emailgroup_id', 'eg.emailaddress_id'))
->fields(
Field::inst( 'eg.emailaddress_id' )
->options( Options::inst()
->table( 'fmsmon.mon_emailaddresses_cfg'.$_SESSION['dblink'].' e' )
->value( 'id' )
->label( 'address' )
),
Field::inst( 'e.address' ),
Field::inst( 'eg.emailgroup_id' )
->options( Options::inst()
->table( 'fmsmon.mon_emailgroups_cfg'.$_SESSION['dblink'].' g' )
->value( 'id' )
->label( 'name' )
),
Field::inst( 'g.name' )
)
->leftJoin( 'fmsmon.mon_emailaddresses_cfg'.$_SESSION['dblink'].' e', 'e.id', '=', 'eg.emailaddress_id' )
->leftJoin( 'fmsmon.mon_emailgroups_cfg'.$_SESSION['dblink'].' g', 'g.id', '=', 'eg.emailgroup_id' )
->debug( true )
->process( $_POST )
->json();
Everything else works perfect. Of course I did not include the entire code like session_start etc.
Thanks
Marek