MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 258 forks source link

Accessing Array from Complex Example #143

Open xjavun opened 3 years ago

xjavun commented 3 years ago

Hello,

how can I read and use the array from the example "Complex".

For me not even the display works as shown in the example. I get the following error message.

View [components.selected] not found. (View: /var/www/html/resources/views/livewire/datatables/datatable.blade.php)

If I remove the part from the example everything works fine again (except the display of course).

public $afterTableSlot = 'components.selected';

But the display is not the main issue. I want to process the IDs of the selected rows. How can I access them.

guywarner commented 2 years ago

@xjavun if you haven't figured it out yet, you need to create a new blade in /resources/components call selected.blade.php

Inside of that put:

print_r($selected, true)

It will output all of the ids in an array. From that you can either put them in a hidden text field and use a form to POST them or livewire it up for another component.