Id Name Birthday Status
221 Forbidden Pirate Detective 23. 11. 1986 inactive
222 Unholy Karate Desperadoes 15. 8. 1986 deleted
223 Amused Ant 26. 6. 1957 inactive
224 Vast Vulture 1. 10. 2000 active
225 Japanese Pogo Insurrection 14. 12. 1965 active
226 Thoughtful Thrush 21. 3. 1992 deleted
227 Terrible Toucan 21. 11. 1985 inactive
228 American Math Wranglers 23. 6. 1932 deleted
229 Shameful Dungeon Romp 18. 7. 1949 active
230 Glamorous Gull 20. 5. 1962 active
231 Insane Battleship Island 2. 5. 1955 inactive
232 Annoying Aardvark 26. 3. 2000 active
233 Attractive Addax 28. 10. 1946 deleted
234 Weary Catapult Hop-A-Bout 12. 7. 1958 inactive
235 Courageous Constrictor 18. 2. 1959 active
236 Adventurous Albatross 10. 10. 1949 inactive
237 Glorious Gnu 26. 3. 1963 deleted
238 Full Metal Monkey Rally 11. 11. 1968 inactive
239 Big Bird Pirate Corps 23. 10. 1939 inactive
240 Frantic Finch 21. 6. 1951 inactive
( Items: 221 - 240 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;
}