F
Filament12mo ago
shahzad

Sortable is not working on Relation Manager class:

I'm facing a weird bug that sortable is not working on the relationship manager class. I have added the code below:

Tables\Columns\TextColumn::make('customer.name')
->searchable()
->sortable(),

Tables\Columns\TextColumn::make('customer.name')
->searchable()
->sortable(),
I'm using default search as well but I even tried removing that but still, it was not working. I need help to make it work. Appreciate your help!
Solution:
Hi, thank you for your help it was the issue with the model, I was using latest() method in the relationship method, and after removing that it is working fine. Thanks again!
Jump to solution
5 Replies
Dennis Koch
Dennis Koch12mo ago
Can you share a short video where you try to sort the data?
shahzad
shahzadOP12mo ago
Hi @Dennis Koch , thank you for your response: Please watch this: https://www.loom.com/share/5e57796e3c0c4754800c7ddbccc25a52
Dennis Koch
Dennis Koch12mo ago
Weird. Is it just on Relation managers? Does it happen on other RMs, too? Are you using the latest version? Any console errors?
shahzad
shahzadOP12mo ago
Exactly, It is not working for all of my relationship managers. Something is wrong as it is working fine for the main resource. I'm using the latest version. Also no error on the console. The livewire request returns effacted value as null once the sorting is clicked. Here is my table code which might give you more context also I have attached livewire request SS:
return $table
->defaultSort('updated_at', 'desc')
->recordTitleAttribute('id')
->columns([
Tables\Columns\TextColumn::make('paymentIntentId')
->label('Payment ID')
->searchable()
->sortable()
->url(fn ($state) => 'https://dashboard.stripe.com/payments/' . $state, shouldOpenInNewTab: true),
Tables\Columns\TextColumn::make('customer.name')
->searchable()
->sortable(),
])
return $table
->defaultSort('updated_at', 'desc')
->recordTitleAttribute('id')
->columns([
Tables\Columns\TextColumn::make('paymentIntentId')
->label('Payment ID')
->searchable()
->sortable()
->url(fn ($state) => 'https://dashboard.stripe.com/payments/' . $state, shouldOpenInNewTab: true),
Tables\Columns\TextColumn::make('customer.name')
->searchable()
->sortable(),
])
No description
Solution
shahzad
shahzad12mo ago
Hi, thank you for your help it was the issue with the model, I was using latest() method in the relationship method, and after removing that it is working fine. Thanks again!
Want results from more Discord servers?
Add your server