Id Name Birthday Status
401 Summer Underwear Trivia 10. 5. 1974 active
402 Proud Pelican 18. 11. 1992 active
403 Victorious Vendace 25. 4. 1944 deleted
404 Innocent Ibis 5. 1. 1964 deleted
405 Tender Tern 9. 6. 1990 deleted
406 Odd Okapi 5. 5. 1957 deleted
407 Frail Frog 13. 2. 1965 active
408 Wooden Guitar Diesel 22. 10. 1950 deleted
409 Hip-Hop Vigilante Ultra 22. 11. 1964 inactive
410 The Last Cannibal Rebellion 8. 10. 1950 inactive
411 Raging Drug-Dealing Heroes 2. 1. 1988 deleted
412 Important Ibis 7. 11. 1995 inactive
413 Comfortable Corncrake 22. 11. 1931 active
414 We Love Banjo Crime Scene Investigation 11. 1. 1962 inactive
415 Samba de Mall from Outer Space 18. 12. 1933 deleted
416 Star Octopus Gladiator 4. 2. 1988 deleted
417 Transvestite Princess Fighter 19. 10. 1946 deleted
418 Dr. Spelling Alpha 3. 2. 1971 inactive
419 Bloody Bear 21. 3. 1936 inactive
420 Claustrophobic Afro Co-Op 6. 3. 1981 inactive
( Items: 401 - 420 from 1020 )
  See the code below 👇 or see GitHub
public function createComponentGrid(): DataGrid
{
	$grid = new DataGrid();

	$grid->setDataSource($this->dibiConnection->select('*')->from('users'));

	$grid->setItemsPerPageList([20, 50, 100]);

	$grid->addColumnNumber('id', 'Id')
		->setAlign('start')
		->setSortable();

	$grid->addColumnText('name', 'Name')
		->setSortable()
		->setFilterText();

	$grid->addColumnDateTime('birth_date', 'Birthday');

	$grid->addColumnText('status', 'Status');

	$grid->addExportCallback('Dump to ajax rq', function (array $rows, DataGrid $grid): void {
		echo 'All fetched data were passed to export callback. Size of data: ';
		echo count($rows);
		die;
	})->setAjax();

	$grid->addExportCsvFiltered('Csv export (filtered)', 'examples.csv')
		->setTitle('Csv export (filtered)');

	$columnName = new ColumnText($grid, 'name', 'name', 'Name');
	$columnEven = (new ColumnText($grid, 'even', 'even', 'Even ID (yes/no)'))
		->setRenderer(
			fn ($item) => $item['id'] % 2 === 0 ? 'No' : 'Yes'
		);

	$grid->addExportCsv('Csv export', 'examples-all.csv')
		->setTitle('Csv export')
		->setColumns([
			$columnName,
			$columnEven,
		]);

	return $grid;
}