Child pages
  • Using the HelperList class

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
$this->fields_list = array(
  'country' => array(                              // First column.
    'title' => $this->l('Country'),                // Column name.
    'width' => 100,                                // Column width. At least one field should be set to 'auto' in order to grow with window size.
    ['align'] => {'left', 'center', 'right'},      // Content position inside the column (default 'left', optional).
    ['type'] => {'select', 'bool', 'date',         // Column format (optional).
      'datetime', 'decimal', 'float', 'percent', 
      'editable', 'price'}, 
    ['list'] => $this->countries_array,            // For type == select only. Content for the select drop down filter list (optional).
    ['filter_key'] => 'cl\!id_country'),           // Define a custom filter key to be used by the filter SQL request 
                                                   // (optional, default uses the array key name, i.e. 'country').
    ['orderby'] => {true, false},                  // If true, list will be alphabetically ordered using this column values (optional, default false).
    ['search'] => {true, false},                   // If true, this column will have a search field (optional, default true).
    ['image'] => 's',                              // If set, an image will be displayed in this field located in the '/img' subfolder defined as value here (optional).
    ['image_id'] => 3,                             // If 'image' is set and if 'image_id' is set, it will be used as the image filename, 
                                                   // else the record item id will be used (optional)
    ['icon'] => array(               	           // If set, an icon will be displayed with icon key matching the field value. 
      0 => 'disabled.gif',                         // Used in combination with type == bool (optional).
      1 => 'enabled.gif',
      'default' => 'disabled.gif'
    ),
    ['active'] => 'status',                        // If set, the field will be replaced by a clickable boolean switch for the item field (i.e. 'status'). 
                                                   // An icon will display the current status.
    ['activeVisu'] => 'new_window',                // If set, the field will be replaced by an icon depending on the boolean value
                                                   // of the field specified (i.e. 'new_window') (optional).
    ['callback'] => 'getOrderTotalUsingTaxCalculationMethod', // If set, the return value of the defined method call 
															  //  will be used as the field content (optional).
    ['callback_object'] => $cart,                  // If set in combination with 'callback', the method will be called from the provided object 
                                                   // instead of the current controller (optional).
    ['prefix'] => '0x',                            // If set, it will be displayed before the field value (optional).
    ['suffix'] => 'kg',                            // If set, it will be displayed after the field value (optional).
    ['currency'] => {true, false},                 // If set and type == price, the currency displayed 
												   // will use the item currency and not the default currency (optional).
    ['maxlength'] => 90,                           // If set, the field value will be truncated if it has more characters than the numeric value set (optional).
    ['position'] => 'position',                    // If set to position, the field will display arrows
												   // and be drag and droppable, which will update position in db (optional).
    ['tmpTableFilter'] => {true, false},           // If set to true, the WHERE clause used to filter results 
												   // will use the $_tmpTableFilter variable (optional, default false).
    ['havingFilter'] => {true, false},             // If set to true, the WHERE clause used to filter results 
												   // will use the $_filterHaving variable (optional, default false).
    ['filter_type'] => {'int', 'bool', 'decimal'}, // Specify the value format when used in the filter where clause.
                                                   // Useful when "filter_type" is different from "type" (i.e. type == select) (optional).
    ['color'] => 'color',                          // If set, the field value will appear inside a colored element. 
                                                   // The color used is the "color" index of the record and is in HTML name or hexadecimal format (optional).
    ['hint'] => $this->l('This is the quantity available in the current shop/group.'), // The hint will appear on column name hover (optional).
	['ajax'] => {true, false}						// if the type is bool, you use ajax
 ),
  'another_field' => array(                        // Second column.
    ...
  ),
  'another_field' => array(                        // Third column.
    ...
  ),
);

...