You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the standard way the CRUD index page is displayed is - if there is no entries in DB there is no table, no table head, just empty page with 'No results found.'
I need to have table head with actual fields for the entity. Is there no easy way of controlling this?
if no then I could get the field names from here $queryBuilder = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);
where $fields contains all the fields which would be displayed, even if there are 0 entries.
then how do I pass it to crud/index.html.twig template?
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
// Build the original query builder (for MyEntity)
$queryBuilder = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters)
$countQb = clone $queryBuilder;
$countQb->select('COUNT(entity.id)');
$count = (int) $countQb->getQuery()->getSingleScalarResult();
if( 0=== $count) {
// extract field names from $fields object and pass it to template somehow;
}
return $queryBuilder;
}
Thanks.
The text was updated successfully, but these errors were encountered:
the standard way the CRUD index page is displayed is - if there is no entries in DB there is no table, no table head, just empty page with 'No results found.'
I need to have table head with actual fields for the entity. Is there no easy way of controlling this?
if no then I could get the field names from here
$queryBuilder = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);
where $fields contains all the fields which would be displayed, even if there are 0 entries.
then how do I pass it to crud/index.html.twig template?
Thanks.
The text was updated successfully, but these errors were encountered: