Unique filters for same table in multiple locations
Hi all,
I have a resource, lets say Product, which has a reasonably developed table, with a few columns with added descriptions, badge columns, filters etc..
I have a second resource Order, and a single order may have multiple Products, so I created a RelationManager to list associated products on the Order resource page. All works fine.
My only problem is that when viewing Products on an Order page, any filters which might have been applied when viewing Products on the Product page, are applied to the view on the Order page.
So essentially my question is, is there away of applying filters uniquely, depending on where the table is displayed?
:wq
4 Replies
I think you can use the same table ProductResource in your ProductsRelationManager class like
ProductsRelationManager.php
Thanks @LeandroFerreira.
Apologies, I realised I wasn't clear in my question. Yes, I am using the same table, by calling the static table method of the Product resource from within my relation manager.
And I think this is part of my issue, because I'm using the same table definition, I have the same filters. But if filters are set on the table on my Product page, then the same filters will be set in the relation on my Orders page. Ideally I don't want these filters linked.
E.g. let's say I have an 'available' toggle filter on my Product table, and that toggle has been set to true on the Products page, then when you navigate to the orders page, that same filter will be applied. :wq
And I think this is part of my issue, because I'm using the same table definition, I have the same filters. But if filters are set on the table on my Product page, then the same filters will be set in the relation on my Orders page. Ideally I don't want these filters linked.
E.g. let's say I have an 'available' toggle filter on my Product table, and that toggle has been set to true on the Products page, then when you navigate to the orders page, that same filter will be applied. :wq
maybe you could inject
$livewire
to add conditions to the filter fields like
Thanks @LeandroFerreira for the pointer, I'll investigate that.