Id Name Birthday Status
421 Educational Viking School 4. 7. 1940 active
422 Cloudy Cardinal 18. 1. 1973 inactive
423 Uptight Unicorn 4. 9. 1983 inactive
424 Famous Flatworm 20. 10. 2000 deleted
425 Bewildered Bee 15. 4. 1965 deleted
426 Romantic Elevator - 2nd Impact 9. 6. 1961 active
427 The Care Bears' Bungie Lord 22. 12. 1968 active
428 Thankful Tapir 5. 4. 1935 deleted
429 Difficult Dotterel 22. 9. 1959 inactive
430 Hazardous Whale On The Road 14. 4. 1991 active
431 Internet Raccoon Carnage 3. 6. 1935 active
432 Jealous Jaguar 4. 1. 1949 deleted
433 Hidden Werewolf Fantasy 8. 9. 1974 deleted
434 Dull Dormouse 2. 6. 1966 active
435 NBA Disco Temple 25. 10. 1993 active
436 Eager Eagle 11. 5. 1957 inactive
437 Witty Wolverine 27. 4. 1950 deleted
438 Ill Impala 15. 3. 1997 inactive
439 Robot Batman Roundup 25. 12. 1981 deleted
440 Victorious Vole 7. 8. 1982 deleted
( Items: 421 - 440 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;
}