when i use data-tables sorting columns woks well
but when using server side laravel-datatables it does not work when clicking on the column header nothing changed no sorting at all !!
although searching works well
this is server code
$provinces = DB::table('provinces')->join('countries','provinces.country_id','=','countries.id')
->select(['provinces.id AS proid', 'countries.name AS cname', 'provinces.code AS code', 'provinces.name AS pname'])->orderBy('provinces.name');
return Datatables::of($provinces)->make(true);
and this is js
$('#provincedataTable').DataTable({
processing: true,
serverSide: true,
stateSave: true,
ajax: 'province/provinces-json',
columnDefs: []
});
"yajra/laravel-datatables-oracle": "v6.11.3"
DataTables 1.10.12
PHP 5.6.15
windows 8.1
You are using join statement which will affect how the sorting works. See this demo and check how it works.
->orderBy('provinces.name'); seems to be what is stopping this. Try implementing
http://datatables.yajrabox.com/eloquent/order-column
Reference https://github.com/yajra/laravel-datatables/issues/115
thanks ..
Most helpful comment
->orderBy('provinces.name'); seems to be what is stopping this. Try implementing
http://datatables.yajrabox.com/eloquent/order-column
Reference https://github.com/yajra/laravel-datatables/issues/115