Id Name Birthday Status
801 Strange Seahorse 19. 4. 1973 active
802 Battle Buddhist Massacre 18. 12. 1971 deleted
803 Adventurous Angelfish 18. 10. 1996 active
804 Viking Cricket Extra 17. 6. 1985 active
805 Lair of the Gun Championship 23. 5. 1933 deleted
806 Tropical Catapult Strikes Back 27. 12. 1991 deleted
807 Shiny Salamander 5. 3. 1959 active
808 Unsightly Unicorn 4. 6. 1996 active
809 Disturbed Dingo 16. 5. 1977 active
810 Tense Thrush 20. 1. 1955 inactive
811 Arcane Jetpack Frenzy 20. 3. 1972 active
812 Xerothermic Xenomorph 2. 1. 1940 active
813 Alive Anteater 2. 3. 1999 deleted
814 Bonk Spatula in Vegas 2. 9. 1931 deleted
815 Light Llama 13. 11. 1961 active
816 Average Anaconda 14. 5. 1941 deleted
817 Dance Dance Night City 7. 12. 1931 deleted
818 Jolly Jellyfish 6. 11. 1950 deleted
819 Energetic Elk 4. 3. 1982 active
820 Atomic Carnival X 21. 1. 1960 active
( Items: 801 - 820 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;
}