DataGrid
DataGrid는 Doggy의 데이터 테이블 컴포넌트로, DataGrid 엔티티 설정 + DataGridService 서버 측 구동으로 페이징, 정렬, 필터링, 내보내기 등 고급 기능을 지원합니다.
개요
DataGrid 시스템은 다음 부분으로 구성됩니다(src/Component/Database/):
Component/Database/
├── Bridge/
│ ├── DataSetInterface.php # 데이터셋 인터페이스
│ ├── DataSource.php # 데이터 소스 추상화
│ ├── DoctrineDataSet.php # Doctrine 데이터셋 구현
│ ├── FilterCondition.php # 필터 조건
│ └── FilterGroup.php # 필터 조건 그룹
└── View/
└── DataGrid.php # DataGrid 뷰 컴포넌트설정
DataGrid는 App\Entity\Platform\DataGrid 엔티티로 설정을 영속화하며, DataGridService가 서버 측 지원을 제공합니다:
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,
]);
}
}필터
DataGrid는 FilterCondition과 FilterGroup으로 필터 조건을 구성하며 AI 자연어 쿼리 Agent와 심층 통합됩니다:
- 텍스트 필터(부분/정확 일치)
- 숫자 범위 필터
- 날짜 범위 필터
- 드롭다운 선택 필터
- 연관 엔티티 필터(dot notation 지원)
데이터 소스
DataSetInterface로 데이터 소스를 추상화하며 현재 지원:
DoctrineDataSet: Doctrine QueryBuilder 기반DataSource: 데이터 소스 베이스 클래스- 커스텀 데이터셋 구현 지원
프론트엔드 컴포넌트
프론트엔드는 sunui_datagrid Twig 매크로로 렌더링합니다:
twig
{% include 'components/datagrid.html.twig' with {
columns: columns,
data: paginator,
config: gridConfig
} %}특징
- 서버 측 페이징과 정렬
- 다중 열 필터(AND/OR 조합)
- 데이터 내보내기
- AI Agent 자연어 쿼리 통합
- 설정을 데이터베이스에 영속화