list_items : add CSS class to column

edited July 2011 in Feature Requests
Is it possible to add CSS classes (or even IDs) to the data returned by list_items (pretty much like you would do with form_fields) ? Say i want to add the class 'highlight' to the col1 of my 'projects' module... how would you do that? I tried adding the 'class' index to the rows of the $data array but all that does is adding another table column ...
ideas? Thankyou

Comments

  • edited 2:58PM
    Sorry, but that is not supported at this time. We'll add that to the list of things to look at though.
  • edited 2:58PM
    so there is no way to add at least ids to columns at all?
  • edited 2:58PM
    Actually... I've looked into this further and may have a fix for you perhaps later today.
  • edited 2:58PM
    that would rock so much!
  • edited 2:58PM
    OK, if you download the latest version you will be able to do something like the following with the special field of '__field__':
    function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc') { $data = parent::list_items($limit, $offset, $col, $order); foreach($data as $key =>$val) { $data[$key]['__field__'] = array( 'label' => array('class' => 'test', 'id'=>'label'.$val['id'] ) ); } return $data; }

    This example would apply the CSS class of "test" to the parent <td> in the "label" field. It would also add the id of "label{key}".

    http://www.getfuelcms.com/user_guide/libraries/data_table
  • edited 2:58PM
    ok great, i'll check this out !
Sign In or Register to comment.