Table recordUrl() to open a modal?
I have a custom page with a table which should open a view type modal when the row is clicked. I already have a ViewAction button defined for each row which loads the modal. However https://filamentphp.com/docs/3.x/tables/advanced#record-urls-clickable-rows only deals with opening a new page not a modal and I can't seem to configure
$table->recordUrl()
to open a modal...
Anyone give me a pointer here? Thanks!11 Replies
Remove the view page from the pages array
Thanks but this isn't a resource page it is a custom page with a table
Ah, if you have the action just put a form on the action so it opens up instead of opening a page iwht the record url?
Thanks again - please can you clarify a little (I am pretty new to Filament) - all I have currently is the custom page with a table definition which has a ViewAction defined that just loads a view blade file in a modal when the button is clicked. No form is used (yet!). I just want the same to happen when the user clicks on the row...
Using V3 just use:
I've added that function however it doesn't get called and the row is non-clickable. Do I need to add something to the blade/page class? The class
extends Page implemenents HasTable
and uses the InteractsWithTable
trait..Change it to a ViewAction since edit will be expecting forms
See if that works, but I am sure you still need to use the forms component for rendering a modal
extends Component implements HasForms, HasTable
{
use InteractsWithForms, InteractsWithTable;
The action defined on the table is already a
ViewAction
..
I have added the InteractsWithForms
concern and the HasForms
contract and the getTableRecordAction()
is still not called and the rows are still not clickable
Anyone?Please post your whole resource
I dunno if you solved your problem, but I think I had the same issue. Here is how I solved it :
The trick is adding
->recordAction('name of your action')
to table and put null
& ''
for icon and label to the ViewAction
I didn't find another way to achieve this.
Hope it helpsThanks for that tip - I will try it out when I get back to that development area