You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
/**
* @param \DataTables\Table\ConfigBundle $configBundle
*/
public function config(ConfigBundle $configBundle): void {
$configBundle->Columns->addDatabaseColumn('Machines.name');
$configBundle->Columns->addDatabaseColumn('Machines.status');
$configBundle->Columns->addDatabaseColumn('Machinetypes.name');
$configBundle->Columns->addDatabaseColumn('Customers.name');
}
generates two errors for me:
the "columns" part in the JSON containes the default columns of my Machines object - which has 7 columns - and thus the ajax data request runs into a warning and an errror:
Undefined offset: 4 [ROOT\vendor\wsssoftware\cakephp-datatables\src\Table\Columns.php, line 214]
Return value of DataTables\Table\Columns::getColumnByIndex() must be an instance of DataTables\Table\Column, null returned
I guess ->addDatabaseColumn does not change the config, just the Columns object
the Customers is a INNER JOIN table to Machines, but there is some error in the query builder and it complains that Customers is not associated with Machines (which it is).
My workaround (and working) solution is a manual contain and a call to setColumns:
/**
* @param \DataTables\Table\ConfigBundle $configBundle
*/
public function config(ConfigBundle $configBundle): void {
$configBundle->Query->contain(['Customers']);
$configBundle->Columns->deleteAllColumns();
$configBundle->Columns->addDatabaseColumn('Machines.name');
$configBundle->Columns->addDatabaseColumn('Machines.status');
$configBundle->Columns->addDatabaseColumn('Machinetypes.name');
$configBundle->Columns->addDatabaseColumn('Customers.name');
$configBundle->Options->setColumns($configBundle->Columns);
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi!
Creating a DataTables object like this
generates two errors for me:
I guess ->addDatabaseColumn does not change the config, just the Columns object
My workaround (and working) solution is a manual contain and a call to setColumns:
The text was updated successfully, but these errors were encountered: