What is the quick way to rename a column name of listing table

edited July 2014 in Modules
This question maybe dumb, but What is the quick way to rename a column name of listing table

Comments

  • edited 7:59PM
    The column names are generated by what is returned from the list_items query on your model (which is inherited from base_module_model). That query can be overwritten (and often is), to return different columns. To change the name of a columns you can use "AS" like displayed in the fuel_navigation_model below:
    $this->db->select('id, label, if (nav_key != "", nav_key, location) AS location, precedence, hidden, published', FALSE);
    You always need the "id" value as the first item in the list.

    Another method is to use the "table_headers" parameter for you module. In the fuel/application/config/MY_fuel_modules.php you can add the following to your module (I'm using a module of clients as an example):
    $config['modules']['clients'] = array( 'preview_path' => '', 'model_location' => 'clients', 'table_headers' => array('id', 'name' => 'Client name', 'website', 'published'), 'default_col' => 'name', 'default_order' => 'asc', );
Sign In or Register to comment.