ArtiGrid
Combobox relacional
The combobox() method allows you to transform a field into a dropdown (select)
with dynamic or static data sources.
It supports two types of sources:
- Database table: You can load options from another table by defining the value and label columns.
- Array: You can define a static list of options using an array.
In this example, the officeCode field is linked to the offices table,
using officeCode as the value and city as the label.
This makes it easy to handle relational data and improve form usability with user-friendly selections.
<?php
$grid = new ArtiGrid();
$grid->table('employees')
->template('bootstrap5')
->unset('filter', false)
->modal();
$grid->combobox('lastName', [
'Activate' => "Activate",
"Desactive" => "Desactive"
]);
$grid->combobox('officeCode','offices','officeCode','city');
echo $grid->render();
?>