Id Name Birthday Status
921 Pathetic Assault on the Oregon Trail 11. 3. 1972 deleted
922 Real Catapult Training 22. 12. 2000 deleted
923 Tame Turtle 4. 12. 1961 active
924 French Zombie Revenge 3. 1. 1945 deleted
925 Tame Tern 1. 9. 1930 deleted
926 Metal Mafia Palace 11. 5. 1964 deleted
927 Bored Bat 28. 7. 1990 deleted
928 Sleepy Shark 12. 8. 1984 deleted
929 Exuberant Eagle 3. 12. 1992 active
930 Excited Eland 22. 9. 1971 deleted
931 Evil Elephant 23. 1. 1937 active
932 Sleepy Skunk 26. 3. 1934 inactive
933 Morbidly Obese Pokemon Melee 22. 1. 1968 deleted
934 Robot Horse Racing Overdrive 18. 9. 1942 deleted
935 Friendly Finch 11. 5. 1954 deleted
936 Fierce Falcon 2. 11. 1950 deleted
937 Uptight Unicorn 1. 12. 1982 active
938 Foolish Fox 13. 9. 1936 active
939 Double Biplane Mansion 10. 9. 1997 deleted
940 Nihilistic Mushroom Havoc 3. 3. 1939 active
( Items: 921 - 940 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;
}