F
Filamentβ€’10mo ago
VR

Edit resource not saving with custom livewire table component in tabs

Hi guys, I have a strange behaviour using custom livewire component with tabs. On the Edit/Create resource I have multiple tabs. Most of them are simple form builders and that's working fine. But when I add a new tab with a custom livewire component (that is only a filament table listing), on trying to save/update the other tabs data is not working, is not able to call the save. Do you encounter something like that? Any insights? Best regards
3 Replies
Tieme
Tiemeβ€’10mo ago
Please read How to write good questions https://discord.com/channels/883083792112300104/1167015843020943390 Where is the code example?
VR
VROPβ€’10mo ago
sure thing πŸ™‚ .... hope that will help But here is some basic code :
class EditProduct extends EditRecord
{
public function form(Form $form): Form
{
return $form
->schema([
Tabs::make('Edit product')->tabs([
Tabs\Tab::make('Info')->schema([
Fieldset::make('General info')->schema([
Toggle::make('is_hidden')->inline(),
...
]),
Tabs\Tab::make('Popular')
->schema([
View::make('popular')->view('filament.products.resources.popular', ['record' => $record])
])
])
])
}
class EditProduct extends EditRecord
{
public function form(Form $form): Form
{
return $form
->schema([
Tabs::make('Edit product')->tabs([
Tabs\Tab::make('Info')->schema([
Fieldset::make('General info')->schema([
Toggle::make('is_hidden')->inline(),
...
]),
Tabs\Tab::make('Popular')
->schema([
View::make('popular')->view('filament.products.resources.popular', ['record' => $record])
])
])
])
}
And the Popular livewire component, is just a simple table preview
class Popular extends Component implements HasForms, HasTable
{
use InteractsWithTable, InteractsWithForms;

public function table(Table $table): Table
{
return $table
->query(PopularModel::query()->where('product_id',$this->product->id)->with('product'))
->columns([
....

}
class Popular extends Component implements HasForms, HasTable
{
use InteractsWithTable, InteractsWithForms;

public function table(Table $table): Table
{
return $table
->query(PopularModel::query()->where('product_id',$this->product->id)->with('product'))
->columns([
....

}
VR
VROPβ€’10mo ago
Hi guys, I will post here the answer for the issue in case somebody else have the same issue. Adding lazy load on load it seems that fixes the issue https://livewire.laravel.com/docs/lazy#lazy-loading-outside-of-the-viewport
Laravel
Lazy Loading | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Want results from more Discord servers?
Add your server