F
Filament14mo ago
mxc

Return infolist from component in a modal from an action?

Hi all, I want to have a modal popup from an action that displays an infolist. I have a livewire component with a method that returns infolist. I am trying to use the modalContent method from Action but not sure how to invoke the infolist method or how to get it to return html? I am trying to do this in a tables ->recordaction method. i.e when one clicks on a row a modal pops up displaying all the detail for that row. The below is my progress so far. and the code is jusst indicative of what I am trying to do to clarify the question.

...
])->recordAction('displayContact');
...
public function displayContact($record){
//return Action::make("View")->modalContent(view("livewire.customer-contact-infolist"));
return view("livewire.customer-contact-infolist",["record"=>"test"]);
}

...
])->recordAction('displayContact');
...
public function displayContact($record){
//return Action::make("View")->modalContent(view("livewire.customer-contact-infolist"));
return view("livewire.customer-contact-infolist",["record"=>"test"]);
}
From what I have read I may have to generate the HTML myself and send that to the modalcontent method but hoping to leverage the work already done creating the infolist in the component. thanks
Solution:
Ok got it working. I added an action to the table->actions([..]) method. ``` ->actions([...
Jump to solution
1 Reply
Solution
mxc
mxc14mo ago
Ok got it working. I added an action to the table->actions([..]) method.
->actions([
Tables\Actions\EditAction::make(),
Action::make("view_contact")
->label("View")
->modalContent(view('livewire.customer-contact-view',["show_info"=>true]))
])
->actions([
Tables\Actions\EditAction::make(),
Action::make("view_contact")
->label("View")
->modalContent(view('livewire.customer-contact-view',["show_info"=>true]))
])
Then
->recordAction(''view_contact")
->recordAction(''view_contact")
Want results from more Discord servers?
Add your server