Id Name Birthday Status
941 Jack Thompson Hang Glider Sisters 6. 6. 1940 deleted
942 Jolly Jackal 1. 8. 1964 deleted
943 Bad Bat 25. 10. 1959 deleted
944 Real Rook 3. 2. 1971 deleted
945 Ingenious Programming Domination 23. 11. 1965 deleted
946 Musical Paintball Punishment 8. 8. 1985 deleted
947 Japanese Boxing Knights 25. 11. 1952 deleted
948 Distinct Dormouse 15. 8. 1967 deleted
949 Upset Unicorn 20. 10. 1981 inactive
950 Testy Tapir 4. 1. 1934 deleted
951 Final Sunshine Dash 8. 2. 1931 deleted
952 Innocent Impala 8. 2. 1961 active
953 Puzzled Penguin 11. 1. 1961 deleted
954 Fair Falcon 1. 9. 1968 deleted
955 Jolly Jellyfish 11. 8. 1946 active
956 Famous Fly 28. 8. 1988 deleted
957 Tender Tarsier 10. 7. 1941 deleted
958 Gentle Goosander 1. 12. 1972 deleted
959 The Last Karaoke from Mars 15. 4. 1975 active
960 Unsightly Unicorn 23. 2. 1963 active
( Items: 941 - 960 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;
}