OrderColumn not working for sorting the list according to updated_at but not working.
This is my code you can see
$product = Product::query()->get();
return Datatables::of($product )
->orderColumn('updated_at', 'DESC')
->make(true);
Javascript code
<script>
$(document).ready(function(){
var columns = [
{
data: 'name',
name: 'name',
searchable: true
},
columns.push({
data: 'action',
name: 'action',
orderable: false,
searchable: "false",
className: "text-center"
});
$('#product-table').DataTable({
pageLength: 25,
processing: true,
serverSide: true,
ajax: {
url: '{{ route('products.dt') }}',
},
columns: columns,
});
});
</script>
$product = Product::query()->orderBy('updated_at', 'DESC');I'm using this then sorting correctly but datatable not working...