Closed eafarooqi closed 8 months ago
Sometimes it can be more complicated. I need to find a way to document this.
Can you take a look at this example?
Sometimes it can be more complicated. I need to find a way to document this.
Can you take a look at this example?
With this examples it works!
@eafarooqi keep in mind that macro method MUST be put AFTER add()
and slot()
method and BEFORE everyelse method, or not work.
I was able to add wire:navigate
Livewire feature on a
tag using this code:
Datatables:
public function actions($row): array
{
return [
Button::add('show')
->slot('Show')
->wire() // <--- HERE
->class('bg-indigo-500 text-white')
->route('balance.show', [
'balance' => $row->id,
])
->target('_self'),
];
}
AppServiceProvider:
public function boot(): void
{
....
Button::macro('wire', function () {
$this->dynamicProperties['wire'] = [
'component' => 'a wire:navigate',
];
return $this;
});
}
It was rendered as:
<div wire:key="action-21-render-action.0.show">
<a wire:navigate target="_self" class="bg-indigo-500 text-white" href="https://localhost/balance/21">Show</a>
</div>
Have you searched through other issues to see if your problem is already reported or has been fixed?
Yes, I did not find it.
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
Yes - I didn't work.
Is there an error in the console?
No
PHP Version
8.1.0
PowerGrid
5.0.3
Laravel
10.23.1
Livewire
3.0.3
Alpine JS
No response
Theme
Bootstrap
Describe the bug.
Extending the button class as per documentation change anchor tag to button and then href will not work on button and also how to add the dynamic property to the action like font Awesome icon. There is no detail like V4.
To Reproduce...
AppServiceProvider boot function
Table actions.
This will result in the following html
now the click will not work. As href on button has no affect and also how can we add the icon to the rendering html. There is no information about this in the documentation.
Extra information