Hiding "precedence" column from list

edited January 2018 in Modules
Hi.
I added a "precedence" column to my table for allowing reordering the records list.
Everything works as expected but i would like to hide the column in the list.
How can i do this?
Thank you!
Love FuelCMS! Saves me a lot of boring work ;)

Comments

  • Override the list_items() function in your model and specify the fields you want to show:
    function list_items($limit=NULL,$offset=NULL,$col='',$order='asc',$just_count=FALSE) { $this->db->select('newsID,newsTitle AS `title`',false); $data = parent::list_items($limit,$offset,$col,$order,$just_count); return $data; }
  • edited 10:13AM
    Hi almostcompletely ;)
    I already tried that. If i do not include the precedence column, the reordering button does not appear and the reordering is not possible
    Thanks!
  • edited 10:13AM
    That's correct, the precedence value needs to be there for the sorting to work.
  • edited 10:13AM
    Ok.
    No way to hide the column, then.
    Thank you!
  • edited November 2017
    Hi!
    I just wanted to say how I solved this.
    I just added...
    public $invisibleFields = array('precedence');
    ... to my model.

    And then, in the items() function of the Module fuel class i added...
    if(isset($this->model->invisibleFields)){
    $this->data_table->only_data_fields = array_merge($this->data_table->only_data_fields, $this->model->invisibleFields);
    }
    ... in line 402.

    This works for any field you will need in the list_items function but you don't want it to show in the table.

    Maybe it's a good idea to add that in future versions.

    Hope it helps!
    By
Sign In or Register to comment.