Summariser showing related data in group
We are trying to show a table of order lines, and use the group feature to group them by order_id.
Ideally we would be able to show data from the related order, and we would be able to specify a custom view / component
So we would have:
===================
Order header
Order 1 : status
Order 1 : date
----------------------
Orderline 1: quantity
Orderline 1: amount
----------------------
Orderline 2: quantity
Orderline 2: amount
===================
Order header
Order 2 : status
Order 2 : date
----------------------
Orderline 1: quantity
Orderline 1: amount
----------------------
Orderline 2: quantity
Orderline 2: amount
Can this be achieved?
8 Replies
Look at the grouping by relationship, i believe it is achievable
thanks for the quick reply. I tried it, and "it works", but not exactly as we want. We would like to define multiple columns to display in the group, and even custom actions (like: change status etc).
Solution
Ahh, you probably want multiple tables instead then I suspect?
yes but paginated "multiple tables" where the pagination should be on order level. So show order 1 -> 10 with orderlines, show order 11 -> 20 with orderlines etc. Is this possible? I have actually even no clue how this could ever work.
anyway, I could understand this is out of scope, in that case we will show the list of orders, and a details modal (but it would have been nice if the above would be possible)
or actually now that I think about it, it could be a table base on orders, with a custom column... that show a table of the orderlines π
I guess this will lead to the answer: https://filamentphp.com/docs/3.x/tables/layout#embedding-other-components
getting somewhere π
I think this is what I want π
So my solution was to base the table on the parent table (orders) and have a panel that renders a custom "orderlines" component.
Important to know is to adapt your query in your OrderResource, so that it already contains the orderlines.