DataGrid
DataGrid is Doggy's data table component, driven by the DataGrid entity configuration and DataGridService on the server side. It supports pagination, sorting, filtering, export, and more.
Overview
The DataGrid system lives in src/Component/Database/:
Component/Database/
├── Bridge/
│ ├── DataSetInterface.php # Data set interface
│ ├── DataSource.php # Data source abstraction
│ ├── DoctrineDataSet.php # Doctrine data set implementation
│ ├── FilterCondition.php # Filter condition
│ └── FilterGroup.php # Filter condition group
└── View/
└── DataGrid.php # DataGrid view componentConfiguration
DataGrid configuration is persisted via the App\Entity\Platform\DataGrid entity. The DataGridService provides server-side support:
php
use App\Service\Platform\DataGridService;
class DataGridController
{
public function index(DataGridService $service): Response
{
$dataGrid = $service->findDataGridByEntityClass(Department::class);
$config = $dataGrid->getDefaultConfigData();
return $this->render('admin/index.html.twig', [
'gridConfig' => $config,
]);
}
}Filters
DataGrid uses FilterCondition and FilterGroup for filter construction, deeply integrated with the AI natural language query agent:
- Text filter (fuzzy/exact)
- Number range filter
- Date range filter
- Dropdown select filter
- Related entity filter (supports dot notation)
Data Sources
The DataSetInterface abstracts data sources. Currently supported:
DoctrineDataSet: Based on Doctrine QueryBuilderDataSource: Base data source class- Custom implementations supported
Frontend Component
The frontend renders via the sunui_datagrid Twig macro:
twig
{% include 'components/datagrid.html.twig' with {
columns: columns,
data: paginator,
config: gridConfig
} %}Features
- Server-side pagination & sorting
- Multi-column filtering (AND/OR combinations)
- Data export
- AI Agent natural language query integration
- Database-persisted configuration