Hide empty tables
When using relationship managers is there a way to make the table not render if there are no records.
Thanks, Damien.
Solution:Jump to solution
like Dennis said, this doesn't make sense if you are using header actions to create or attach a record.
Anyway, if you want to hide it, I think you can use
getRelationManagers
in your Edit or View page:
```php...3 Replies
You'd still have an empty tab, right? Doesn't that look weird?
You can overwrite
public function getRelationManagers(): array
to filter the relation manager, but I think that's confusing, too.
For overwriting the actual rendering check getRelationManagersContentComponent()
from HasRelationManagers
trait.Solution
like Dennis said, this doesn't make sense if you are using header actions to create or attach a record.
Anyway, if you want to hide it, I think you can use
getRelationManagers
in your Edit or View page:
Remove the relation manager class from getRelations
method in the ResourceSorry, maybe I didn't explain it well, let's say for example I have users and addresses. I could have resources for both.
I'd create the address in the address resource and the tab and table would only render for the user that has any addresses attached to them.
Just to confirm though, this worked perfectly. Thank you