Hiding "precedence" column from list
  • 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 ;)
  • 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;
    }
  • 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!
  • That's correct, the precedence value needs to be there for the sorting to work.
  • Ok.
    No way to hide the column, then.
    Thank you!
  • 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

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!