Resource link for EditPage - force page rather than modal
I have a rather funky listrecords which effectively groups a lot of records into a single row/column. My DetailSummary extends EditRecord and the problem is that when I click the link, it opens a modal with a different (default) schema/form, rather than opening the custom page I have built. I noticed in this page https://discord.com/channels/883083792112300104/1428162347796664501/1428377033922056202 that you can define the schema - but I am unable to use Actions as I need to return html.
Here is what is really strange; If I remove the edit page from the getPages() in resources, the link loads SummaryForm schema in a modal. If I leave the edit page in tact, even though it isnt called, the detail link works perfectly fine and loads the page rather than a modal!?
DetailSummary:
ListRecords:
Solution:Jump to solution
Yes. That's what I explained. You have a
form() on the resource and an EditAction so Filament assumes you want to use that form. Opening a modal is a JS event while going to a page is a link. The JS event even fires when you click a link in that row.8 Replies
Unbelievable - I had been trying to solve this for several days. The answer:
$table->recordAction(null)
I think this might actually be a bug as imho a link displayed in the column should take precedent. If someone clicks on the column rather than the linked text I would understand it taking you to the EditRecord.
Did you directly click the link? Maybe this is a new bug, but I used links inside a table in the past and had no issues I think
Yes - directly clicked the link.
And the link doesn't open? I tried it and the link opens and than the modal. You need to add this to the link
onclick="event.stopPropagation()" to prevent the modal from opening.
Here is what is really strange; If I remove the edit page from the getPages() in resources, the link loads SummaryForm schema in a modal. If I leave the edit page in tact, even though it isnt called, the detail link works perfectly fine and loads the page rather than a modal!?That's the default behaviour of
EditAction and ViewAction. It's looking for a page with that name and if it doesn't find one, but you define a schema, it will open in a modal.
My DetailSummary extends EditRecord and the problem is that when I click the link, it opens a modal with a different (default) schema/form, rather than opening the custom page I have builtThat's because you rename the route from
edit to details. Filament doesn't know that you details page is actually an edit page.
If I leave the edit page in tact, even though it isnt called, the detail link works perfectly fine and loads the page rather than a modal!?That's because one is probably a normal HTML link, while the other is a JavaScript event that triggers the modal. Events are fire onclick.
For me - the following code will display the modal and not redirect to DetailSummary IF getPages() does not have 'edit' defined:
IF getPages DOES have edit defined then there is no modal and it redirects to the DetailSummary page.
Solution
Yes. That's what I explained. You have a
form() on the resource and an EditAction so Filament assumes you want to use that form. Opening a modal is a JS event while going to a page is a link. The JS event even fires when you click a link in that row.I bet we can improve this, but for now it is what it is, and you'd need to set the
onclick handler on the link to prevent the modal from opening.Verstanden - danke!