datagrid icon indicating copy to clipboard operation
datagrid copied to clipboard

How to write double reference to table

Open nakoukal opened this issue 4 years ago • 0 comments
trafficstars

Hi it is possible get name(column) from referenced table, where is double referenced column ? In this example datagrid returns only one name and fill it to both column (places id from , places id to)

$grid = new DataGrid;

	$grid->setDataSource($this->materialMovementsRepository->findAll());

	$grid->setItemsPerPageList([20, 50, 100], true);

	$grid->addColumnNumber('id', 'id')
		->setSortable();

	$grid->addColumnText('materials_id', 'Material','materials.a2c')				
		->setFilterText();

	$grid->addColumnText('places_id_from', 'From','places.name')				
		->setFilterText();
	
	$grid->addColumnText('places_id_to', 'To','places.name')				
		->setFilterText();

	$grid->addColumnNumber('quantity', 'quantity')
		->setFilterText();

	$grid->addColumnDateTime('date', 'Date')
		->setFormat('j. n. Y')
		->setFilterDate();
	
	return $grid;

er_diagram

nakoukal avatar Oct 07 '21 08:10 nakoukal