Datatables Defer_Loading Integrating with Join Table Function Problem
Datatables Defer_Loading Integrating with Join Table Function Problem
https://datatables.net/examples/server_side/defer_loading.html
https://datatables.net/examples/server_side/pipeline.html
I have successfully implemented something based on the weblinks above.
However, when I working on getting data from another table, it is throwing an error.
when i defining the columns:
$columns = array(
array( 'db' => 'booking.bkg_number', 'dt' => 0 ),
array( 'db' => 'client.clt_firstname', 'dt' => 1 ),
array( 'db' => 'client.clt_email', 'dt' => 2 ),
array( 'db' => 'booking.bkg_status', 'dt' => 3 ),
array( 'db' => 'booking.bkg_travel_class', 'dt' => 4 ),
array( 'db' => 'staff.stf_firstname', 'dt' => 5 ),
array( 'db' => 'booking.bkg_website', 'dt' => 6),
array( 'db' => 'booking.bkg_created_datetime', 'dt' => 7)
);
I modified simple( $request, $conn, $table, $primaryKey, $columns ) function:
$data = self::sql_exec( $db, $bindings,
"SELECT ".implode(", ", self::pluck($columns, 'db'))."
FROM `$table`
INNER JOIN client ON booking.bkg_client_id=client.client_id
INNER JOIN staff ON booking.bkg_consultant_id=staff.staff_id
$where
$order
$limit"
);
When processing data at "data" => self::data_output( $columns, $data )
It is throwing an error:
Notice: Undefined index: booking.bkg_bkg_number in ...\ssp.class.php on line 38
Notice: Undefined index: client.clt_firstname in ...\ssp.class.php on line 38
Notice: Undefined index: client.clt_email in ...\ssp.class.php on line 38
...
which is $row[ $column['dt'] ] = $data[$i][ $columns[$j]['db'] ];
If this option is a dead end...
I understand Datatable Editor got the Join Table Extension I can use with,
however, how can that integrate with the defer data loading function?
Answers
The demo SSP class doesn't include support for joined tables I'm afraid. You'd need to modify the code to add that ability. I'm sure its possible, its just not something I've looked at before (although I know others have).
With the Editor library, you would need to effectively simulate the initial "get data" request to render it into HTML. I guess you need to do that with the demo script anyway though.
Allan
Thank you for the reply
I will have a look at both options then.