Disable reordering when user not on "all" tab

Is there a way to disable reordering based on the user tab? I have three tabs. All. Active. Inactive. If half the tasks are in Active and half are in Inactive I'd like to disable re-ordering. I've looked at doing this on the resource: ->reorderable('sortable_column', request('activeTab') === 'all' || !request()->has('activeTab'))->defaultSort('sortable_column'); This works. However when the user changes the tab the changes aren't reflected in the request() so the tab still shows/doesn't show incorrectly. Can explain further if required. I'm thinking some sort of alpine to launch on url change but I'm not sure how I'd go about this in Filament. Many thanks for any help.
1 Reply
Shroomteller
Shroomteller10mo ago
You have to use a closure to pass the boolean value, like so: ->reorderable('sortable_column', fn (Table $table): bool => $table->getLivewire()->activeTab !== 'all') I've tested it and this works for me, so all that's required is to customize the logic inside the closure.
Want results from more Discord servers?
Add your server