Jump to content


Rodrigo Furtado

Member Since 21 Jan 2013
Offline Last Active Jun 17 2013 10:00 AM
-----

Topics I've Started

ORDER BY works only for one column at a time

21 January 2013 - 12:34 PM

Currently, it's not possible to order by multiple columns with grocery crud, but code igniter has this functionality, so it must be something really easy to correct :)

Lets say we have this table

id | company_name | segment | relevance
1 |  bbbbbbbbbbbb |   industry  | 50
2 |  cccccccccccccc |   industry  | 100
3 |  aaaaaaaaaaaa | commerce | 25

4 |  dddddddddddd | goverment | 10

And we try to order like this:

        $crud->order_by('segment','asc');
        $crud->order_by('relevance','desc');
        $crud->order_by('company_name','asc');

It 'll only order by the LAST order_by you put and totally ignore the rest.

AMEN ?