Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

function filter model

hi,
I met a problem with the function filters (), it lists all the table elements
always the new version fuelcms
thank you

Comments

  • edited 5:30PM
    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 5:30PM
    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 5:30PM
    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 26
    thanks ,
    that's why I ask you to correct it, please give me the exact function
  • edited 5:30PM
    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.