Hello, I want to insert two datatables in one view.
this is my controller
public function create(PlaceDataTable $placeDataTable, EmailRecipientsDataTable $emailRecipientsDataTable)
{
return $placeDataTable ->render('digest-report.create');
}
this is my HTML view
<form id="setting-form" action="#" method="POST" class="wizard-big"
action="{{route ('place.store')}}">
<h1>Customer</h1>
<div class="table-responsive">
{!! $dataTable->table(['id' => 'place-table','class' => 'table table-striped table-bordered table-hover'], false) !!}
</div>
<div class="table-responsive">
{!! $dataTable->table(['id' => 'emailrecipients-table','class' => 'table table-striped table-bordered table-hover'], false) !!}
</div>
this is my javascript
{!! $dataTable->scripts() !!}
I trying to add EmailRecipientsDataTable to controller for render the datatable in the view, but I can't return two values on my controller
then I want to make the datatable clickable to capture the row data and be able to use it in the view
what is the best way for this?
You can use datatables:html.
php artisan datatables:make Recipients --builder
php artisan datatables:html Recipients
public function create(PlaceDataTable $placeDataTable)
{
$recipients = RecipientsDataTableHtml::make();
return $placeDataTable ->render('digest-report.create', compact('recipients');
}
// view
{!! $dataTable->table() !!}
{!! $recipients->table() !!}
{!! $dataTable->scripts() !!}
{!! $recipients->scripts() !!}
thanks!
Have you tried it? Is it run successfully? If yes can you give how you use it? @andrecuellar
Most helpful comment
You can use datatables:html.
To create a DT with extracted builder.
To create an HTML builder
Usage