Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Sort Descending broken #366

@AdamRV9

Description

@AdamRV9

I'm using Laravel 5 for the first time and am using this plugin to pull data from a MySQL database.

The following code sits inside my controller:

return Datatable::collection(Invoice::all(array('id','date_issued','date_due','user_id','total','status')))
        ->showColumns('id', 'date_issued', 'date_due', 'user_id', 'total', 'status')
        ->searchColumns('id', 'date_issued')
        ->orderColumns('id','date_issued')
        ->make();

This code sits in my blade template:

{!! Datatable::table()
        ->addColumn('Invoice ID','Date Issued','Date Due','Client','Total','Status')
        ->setUrl(route('api.invoices'))
        ->render() !!}

The datatable displays correctly initially, but if I click the "id" or "date_issued" table heading to sort "desc" I get no records, just the message: "No matching records found". If I click the heading again to sort "asc" the records come back.

I can see the AJAX requests via Firebug. The only difference to my eye is sorting "asc" returns an array and "desc" returns on object. I'm not sure if I'm going wrong or if this is a bug...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions