Id Name Birthday Age
673 Zombie Batman Struggle 28. 9. 1948 76
687 Zombie Spelling on the Oregon Trail 22. 10. 1987 37
321 Zealous Zebra 8. 3. 1999 25
901 Zany Zebra 17. 1. 1973 51
694 Zany Zebra 1. 2. 1988 36
540 Zany Desert Jam 25. 5. 1938 86
217 Yucky Yak 23. 8. 1938 86
60 Yucky Yak 19. 10. 1995 29
700 Yucky Yacare 2. 6. 1930 94
719 Yellowed Yak 23. 8. 1931 93
619 Yellowed Yak 28. 2. 1944 80
796 Yellowed Yak 3. 3. 1993 31
98 Yellowed Yacare 1. 11. 1978 46
564 Yawning Yacare 17. 10. 1944 80
812 Xerothermic Xenomorph 2. 1. 1940 84
781 Xenophobic Xenomorph 23. 12. 1994 29
15 Xenophobic Xenomorph 3. 3. 1987 37
91 Xenophobic Xenomorph 10. 2. 1958 66
832 Xenophobic Xenomorph 22. 8. 1991 33
385 Xenophobic Xenomorph 21. 5. 1978 46
( Items: 1 - 20 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], true);

	$grid->addColumnText('id', 'Id')
		->setSortable();

	$grid->addColumnText('email', 'E-mail')
		->setSortable()
		->setFilterText();

	$grid->addColumnText('name', 'Name')
		->setFilterText();

	$grid->addColumnDateTime('birth_date', 'Birthday')
		->setFormat('j. n. Y');

	$grid->addColumnNumber('age', 'Age')
		->setRenderer(fn (Row $row): ?int => DateTime::fromSafe($row->asDateTime('birth_date'))?->diff(new DateTime())->y);

	return $grid;
}