Filters

How can I put a dropdown on top of the page to filter a list? For example, filter articles by authors?
Thank you!

Comments

  • edited 11:06PM
    Im using simple models...
  • edited 11:06PM
    The navigation module may be a good one to look at. The module has the 'filter' parameter set on at fuel/modules/fuel/config/fuel_modules.php which takes an array of parameters similar to what you would use for form_builder. The options for the select are actually set in the fuel/modules/fuel/controllers/navigation.php file in the list_items method however, they could be set within the fuel_modules file as well.
  • edited 11:06PM
    I created a controller inside controllers/ with this:

    <?php

    class Questions extends CI_Controller {

    function __construct(){
    parent::__construct();
    }

    function items(){
    $this->load->model('Areas_model');
    $this->filters['area_id']['options'] = $this->Areas_model->options_list('id', 'name', array(), false);
    parent::items();
    }

    }

    ?>

    But it doesn't work :(
    It's obvious im doing something wrong here...
    Any thoughts?
  • edited 11:06PM
    You'll want to extend the Module controller.
  • edited 11:06PM
    you mean Base_module_controller?
  • edited 11:06PM
    ive replaced Base_module_controller with CI_Controller, doesnt work either
  • edited 11:06PM
    The fuel/modules/fuel/controllers/navigation.php file should have at the top the following:

    require_once('module.php'); class Navigation extends Module {
    In your case the require_once will probably need a different path to point to the module.php file since your model will exist somewhere else. Does that make sense?
Sign In or Register to comment.