F
Filament7mo ago
Saturn

Call action after page load to table mount action

So im getting an URL query parameter. but what i want is after page load it should call to table mount action which is not happening rn. Let me know if u need anything.
13 Replies
LeandroFerreira
LeandroFerreira7mo ago
Are you using a page action? Share some code please
Saturn
SaturnOP7mo ago
class ManageProofRequesteds extends ManageRecords
{
protected static string $resource = ProofRequestedResource::class;
#[Url]
public ?string $proof;

public function mount():void
{
parent::mount();
$this->js('$wire.mountTableAction("Proof",'.$this->proof.")");
}
}
class ManageProofRequesteds extends ManageRecords
{
protected static string $resource = ProofRequestedResource::class;
#[Url]
public ?string $proof;

public function mount():void
{
parent::mount();
$this->js('$wire.mountTableAction("Proof",'.$this->proof.")");
}
}
Url with query parameter: http://...../admin/proof-requesteds?proof=3 But in this case the action is getting called early before table livewire component is loaded and thus causing error. I need to call $this->js('$wire.mountTableAction("Proof",'.$this->proof.")"); after page load,
LeandroFerreira
LeandroFerreira7mo ago
where is proof action?
Saturn
SaturnOP7mo ago
proof is not an action but a query parameter mountTableAction of the table component is the only action I need to call
LeandroFerreira
LeandroFerreira7mo ago
Where is the action that you need to call?
Saturn
SaturnOP7mo ago
its in resouces pages directory, its a simple resource. so basically whenever user redirects to my resource page with that particular query parameter in the url, I want to open the modal( just like we do when we click on any table record, a modal opens) but this time without clicking but through query parameter,
LeandroFerreira
LeandroFerreira7mo ago
You can pass the action name in the url: ?action=your_action Like this: https://demo.filamentphp.com/blog/categories?action=import
Saturn
SaturnOP7mo ago
my action has parameters to it eg: mountTableAction('Proof',3) where 'Proof' is action name & 3 is table id you suggested answer for an custom/normal action. If you can suggest for table action, which has parameters to them Eg: https://demo.filamentphp.com/blog/categories in same page we have table with view action that shows details of particular row. its call to server is: mountTableAction('View',1) where View is the action name & 1 is the record any idea ?
LeandroFerreira
LeandroFerreira7mo ago
A workaround, actually
class ManageProofRequesteds extends ManageRecords
{
public function getFooter(): ?View
{
return view('custom-footer');
}
}
class ManageProofRequesteds extends ManageRecords
{
public function getFooter(): ?View
{
return view('custom-footer');
}
}
<!-- custom-footer.blade.php -->
@script
<script>
$wire.mountTableAction('edit', 3)
</script>
@endscript
<!-- custom-footer.blade.php -->
@script
<script>
$wire.mountTableAction('edit', 3)
</script>
@endscript
whatsisname
whatsisname3mo ago
Hey @Leandro Ferreira, is there a anything in the documentation about the URL parameter "action" that you are using in the categories example? Or is it a custom implemantation?
LeandroFerreira
LeandroFerreira3mo ago
there isn't in the docs..
whatsisname
whatsisname3mo ago
Ah too bad. Because it does not work, when I try it. Would to check the specifics bout this feature.
LeandroFerreira
LeandroFerreira3mo ago
open a new topic, explain the issue and share your code please
Want results from more Discord servers?
Add your server