Filters not appearing in advanced search

edited June 2014 in Modules
Hi,

I'm trying to use filters in simple modules using a join in list items. But I have not success so far. After reading some documentation and looking for other post I tried to do my filters function like this:

function filters(){ $filters['IDcourse'] = array( 'label' => 'Course', 'type' => 'select', 'options' => $this->courses_model->options_list(), 'first_option' => 'Show All' ); return $filters; }

In my_fuel_modules I set 'advanced_search' => TRUE to the module and at the beginning of the model I have this:
public $required = array('IDcourse');

When I click the button for the advanced search there nothing appears. How can I make this work properly?

I could see that in other versions of fuel we can set the filters in the config file, I also tried that and here the dropdown of courses is displayed correctly but no data is displayed even before I do the search.

FYI, IDcourse is a foreign key for my courses table.

Comments

  • edited 11:42PM
    Are you clicking the triangle in the search box to the right?
  • edited 11:42PM
    Of course, and the white square just show de title of "Advanced Search" and the buttons, search, close and reset search but the input field is not displayed
  • edited 11:42PM
    If you set advanced_search equal to FALSE, do the filters show up in the list view to the right of the buttons?
  • edited 11:42PM
    Nope, if I set to false neither the triangle nor the buttons are displayed. What else can I do?
  • edited 11:42PM
    Just to confirm that your filters method is in your main table class and extends the base_module_model correct? If so, I would debug the fuel/modules/fuel/controllers/module.php on line 190 and debug the value of $this->filters.
  • edited 11:42PM
    Thank you, now it's working. For a weird reason (I didn't open that file before), one line was commented

    if (method_exists($this->model, 'filters')) { //$this->filters = array_merge($this->filters, $this->model->filters($this->filters)); }

    I just uncomment that line and now it's working
Sign In or Register to comment.