Not able to filter table on custom livewire component

What I am trying to do: I try to filter a table implemented in a custom livewire component. What I did: I added the HasTable and HasForm contracts and the useInteractsWithTable and the useInteractsWithForm traits in my custom livewire component. I also implemented the table function, my records are well retrieved and displayed then i added a SelectFilter to filter on a category field. My issue/the error: When i use my filter nothing happens and i have no errors, the filter does not appears in the table header, the query strings are not updated and ofcourse my table is not filtered. The same table is working great in admin panel.
$table
->relationship(fn (): HasMany => getAsUser()->profile->products())
->recordTitleAttribute('wording')
->emptyStateDescription('Ajouter un produit pour commencer')
->headerActions([
])
->columns([
TextColumn::make('wording')
->label('Libellé')
->weight(FontWeight::Bold)
->sortable(),
TextColumn::make('category')
->label('Catégorie')
->badge()
->sortable()
->toggleable(),
TextColumn::make('created_at')
->label('Date d\'ajout')
->date('d/m/Y', \getAsUser()->timezone)
->sortable(),
])
->filters([
SelectFilter::make('category')
->label('Catégorie')
->options(ProductCategory::class)
->native(false)
])
->actions([
])
->bulkActions([
]);
$table
->relationship(fn (): HasMany => getAsUser()->profile->products())
->recordTitleAttribute('wording')
->emptyStateDescription('Ajouter un produit pour commencer')
->headerActions([
])
->columns([
TextColumn::make('wording')
->label('Libellé')
->weight(FontWeight::Bold)
->sortable(),
TextColumn::make('category')
->label('Catégorie')
->badge()
->sortable()
->toggleable(),
TextColumn::make('created_at')
->label('Date d\'ajout')
->date('d/m/Y', \getAsUser()->timezone)
->sortable(),
])
->filters([
SelectFilter::make('category')
->label('Catégorie')
->options(ProductCategory::class)
->native(false)
])
->actions([
])
->bulkActions([
]);
Thank you in advance for your answers and sorry for the bad english.
2 Replies
Quentin
QuentinOP4mo ago
To add some context, my component is a full page component
Want results from more Discord servers?
Add your server