Render Single Table action on different place
My table has multiple TableHeaderActions. 1 want all of them on the place they render by default, except one. Which i want to render elsewhere.
So far i found
It renders the button where i want, but it doesnt work. Only when i add this button to the tableHeaderActions as well, it works. But then it is rendered in both places. It's like the modal doesnt render like this.
I tried to
But that gives me errors about the $action variable not being set.
I get that the button i render has
wire:click="mountTableAction('action')"
and its not in de table action array. So is there a way to include it in the tableaction array, but not have it render with the rest?
Question:
How do i render 1 tableHeaderAction in a different place from the rest?2 Replies
Update: i sort of got it working, but it feels quite hacky:
i added the Action to the getTableHeaderActions array, and added
->view('custom-view')
this custom-view is an empty blade file. This way it doenst render anything in the headeractions. Then i added the blade directive to render the html on the new position.
Would be nice if i could just do ->hidden()
in the tableHeaderActions and the modal would still work when triggering from another button. Or a new callback like ->invisible()
Or am i missing a completely obvious better way?if the action isnt registered its not gonna work
because we cant just guess what logic to run when the button is pressed
in v3 actions can be added anywhere on a livewire component. thats what you'd need