Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorting does not working when using server side laravel-datatables #581

Closed
macnux opened this issue May 29, 2016 · 3 comments
Closed

sorting does not working when using server side laravel-datatables #581

macnux opened this issue May 29, 2016 · 3 comments

Comments

@macnux
Copy link

macnux commented May 29, 2016

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

@yajra
Copy link
Owner

yajra commented May 30, 2016

You are using join statement which will affect how the sorting works. See this demo and check how it works.

@ChaosPower
Copy link
Contributor

ChaosPower commented May 31, 2016

->orderBy('provinces.name'); seems to be what is stopping this. Try implementing

http://datatables.yajrabox.com/eloquent/order-column

Reference #115

@macnux
Copy link
Author

macnux commented Jun 1, 2016

thanks ..

@macnux macnux closed this as completed Jun 1, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants