function filter model

edited January 2018 in News & Announcements
hi,
I met a problem with the function filters (), it lists all the table elements
always the new version fuelcms
thank you

Comments

  • edited 7:33PM
    In the model's list_items method, add a select like so:

    public function list_items($limit = NULL, $offset = NULL, $col = 'last_updated', $order = 'desc', $just_count = FALSE) { $this->db->select('table.id, table.field1, table.field2...'); $data = parent::list_items($limit, $offset, $col, $order, $just_count); }
  • edited 7:33PM
    public function filters(){

    if (defined('FUEL_ADMIN'))
    {
    $CI =& get_instance();
    }

    $ds = $this->get_articles();



    $sq = array();

    foreach ($ds as $cb)
    {
    $sq[$cb->id_type_bien] = $cb->id_type_bien;
    }

    $filters['id_type_bien'] = array(
    'label' => 'Filter',
    'type' => 'select',
    'options' => $sq,
    'first_option' => 'Show All'
    );

    return $filters;
    }

    it lists all the table elements
  • edited 7:33PM
    Are you referring to the select options displaying all of the items or the data result being returned by the filters? I'm not sure what I'm looking at here.
  • edited January 2018
    thanks ,
    that's why I ask you to correct it, please give me the exact function
  • edited 7:33PM
    Sorry, but I'm unclear as to what you are asking for. Are you wanting the data results returned from the table filtered view to not display all the columns? If so, see my post above about using the select statement.
Sign In or Register to comment.