Id Name Birthday Status
861 Fine Flamingo 20. 9. 1966 deleted
862 Enormous Rollerball Assassins 6. 12. 1987 deleted
863 Dark Dugong 19. 10. 1988 deleted
864 Frisky Sewer Espionage 25. 5. 1936 inactive
865 Tasteless Booty Master 3. 5. 1966 deleted
866 Deep Space Big Game Hunter Orchestra 4. 10. 1933 deleted
867 Lazy Leopard 20. 10. 1974 active
868 Lair of the Stick Princess 6. 1. 1990 deleted
869 Fatal Fishing Creator 27. 12. 1961 active
870 MTV Jazz Deathmatch 7. 10. 1949 active
871 Ill Impala 25. 1. 1990 inactive
872 Strange Scarab 13. 3. 2000 deleted
873 Galactic Bomberman Fun 4. 7. 1988 deleted
874 Adorable Addax 17. 6. 1931 inactive
875 Wooden Cookie Havoc 12. 6. 1955 deleted
876 Cautious Cod 3. 9. 1953 deleted
877 Inappropriate Cooking Underworld 20. 1. 1998 deleted
878 Helpful Hoopoe 6. 3. 1945 deleted
879 Almighty Surf in Busytown 14. 8. 1966 deleted
880 Fantastic Fox 28. 4. 1993 deleted
( Items: 861 - 880 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;
}