Method target() with _blank doesn't work
pablov01 opened this issue · 1 comments
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.2
PowerGrid
5.4.5
Laravel
10.47.0
Livewire
3.4.9
Alpine JS
No response
Theme
Tailwind 3.x
Describe the bug.
I was creating a button that redirects me to a view, reading the documentation https://livewire-powergrid.com/table-features/button-class.html#target, the target() method, giving it the '_blank' parameter allows you to open it in a new window, but when testing it, it loads the view in the current window I'm working on. I provide my sample code:
looking at the button properties if it shows target='_blank':
To Reproduce...
With this in mind, the view loads in the current window and does not open a new window as it should.
example.mp4
Extra information
Something else I can add is that the documentation says that by default it uses the '_blank', so I understand that by putting only the ->target() it should use the '_blank', but no, I have to write it for it to work, otherwise it throws this error:
code without passing the parameter to ->target():
Button::add('ver')
->slot('VER')
->id()
->class(TableService::getVerPDFActionButtonClasses())
->target()
->dispatch('verPDF', ['row' => $row->id]),
Error:
Too few arguments to function PowerComponents\LivewirePowerGrid\ProcessDataSource::PowerComponents\LivewirePowerGrid\{closure}(), 1 passed and exactly 2 expected.
It may be something to do with my reading comprehension, but I don't doubt it would happen to someone else :).
Hello!. The target method can only be used with the route. In version 6.x this will be deprecated and migrated to the third parameter of the route method.
Thank you