Search code examples
codeignitergrocery-crud

GroceryCRUD - ordering the fields list (not ordering the actual data, just the order of the fields)


In GroceryCRUD i am getting the data from a table with these fields (as they appear in order in MYSQL)

id,
date_added,
views,
outhits,
clicks,
title,
description

and i want title + description to be at the top of the form when entering new rows or editing rows. how can this be done?


Solution

  • I solved this by using the columns() method and specifying the order in that list so in your case, try:

    $this->grocery_crud->columns('title',
                                 'description',
                                 'id',
                                 'date_added',
                                 'views',
                                 'outhits',
                                 'clicks');