Search fields for list view

edited March 2013 in Feature Requests
I'm using version 1.0.

I have tried this in my simple module model:
public $filters = array('first_name', 'last_name', 'email'); public $filter_join = 'or';
and tried this in My_fuel_modules.php:
'filters' => array('first_name', 'last_name', 'email'), 'filter_join' => 'or',
But entering a last name in the CMS list view's search field returns an empty recordset. I saw in another discussion where the filters and filter_join params were not for the list view. How do I include all fields that are shown in the list view in the search query?

Comments

  • edited 4:48AM
    Ok, I'm an idiot. I was working in an old branch. I've pulled the latest version and made my entries in the correct branch. So now, there's this error:
    A PHP Error was encountered Severity: Notice Message: Undefined offset: 1 Filename: controllers/module.php Line Number: 223 A PHP Error was encountered Severity: Notice Message: Undefined offset: 2 Filename: controllers/module.php Line Number: 223

    The section in /fuel/modules/fuel/controllers/module.php it refers to is this:
    // create search filter $filters[$this->display_field] = $params['search_term']; // sort of hacky here... to make it easy for the model to just filter on the search term (like the users model) $this->model->filter_value = $params['search_term']; foreach($this->filters as $key => $val) { $filters[$key] = $params[$key]; if (!empty($val['filter_join'])) { if (!is_array($this->model->filter_join[$key])) // this is line 223 { settype($this->model->filter_join, 'array'); } $this->model->filter_join[$key] = $val['filter_join']; } } // set model filters before pagination and setting table data if (method_exists($this->model, 'add_filters')) { $this->model->add_filters($filters); }
    Seems like it's expecting a defined key array like 'key' => 'value'.
  • edited 4:48AM
    Wow. Right after adding the last post I figured out what i was doing wrong.

    I had entered the filters and filters_join params in My_fuel_modules.php AND in the model itself. I removed them from My_fuel_modules.php and left them in the model itself and it started working like a charm!
Sign In or Register to comment.