I want to display 2 tables in the same view. My current approach leads to this error:
DataTables warning: table id=dataTableBuilder - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
Controller:
$builderAssignedIps = $dataTable->getHtmlBuilder();
$tableAssignedIps = $builderAssignedIps->columns([
['data' => 'ip_address', 'name' => 'ip_address', 'title' => 'IP Address'],
['data' => 'created_at', 'name' => 'created_at', 'title' => 'Assigned at']
]);
$builderAssignedDomains = $dataTable->getHtmlBuilder();
$tableAssignedDomains = $builderAssignedDomains->columns([
['data' => 'domain', 'name' => 'ip_address', 'title' => 'Domain'],
['data' => 'created_at', 'name' => 'created_at', 'title' => 'Assigned at']
]);
View:
{!! $tableAssignedIps->ajax(route('get.order.assignedIPAddresses', $purchase))->table() !!}
{!! $tableAssignedDomains->ajax(route('get.order.assignedDomains', $purchase))->table() !!}
{!! $tableAssignedIps->scripts() !!}
{!! $tableAssignedDomains->scripts() !!}
Laravel Version: 5.3
DataTable Version: 6.0
Any help would be appreciated..
Thanks
You need to assign a different table id for each tables.
->table(['id' => 'table-ips'])
->table(['id' => 'table-domain'])
Thanks!
@yajra please give me full example for this code actually response from the controller or maybe add to documentation would be appreciated. This is important stuff
Thanks.