In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

order_by

void order_by(mixed $order_by [, string $direction] )
Quick Description: A quick first order_by (same as codeigniter) to our list

A quick ordering when the user first visits the list page(work the same way as codeigniter)

Example:

function customers_example() {
    $crud = new grocery_CRUD();
 
    $crud->set_table('customers')
        ->set_subject('Customer')
        ->columns('customerName','contactLastName','creditLimit');
 
    $crud->fields('customerName','contactLastName','city','creditLimit');
 
    $crud->order_by('creditLimit','desc');
 
    $output = $crud->render();
 
    $this->_example_output($output);
}