1
votes

I haven't found a way yet to customize what items are shown in the "list" view. To be a little bit more specific : by default all the records in a database table are selected and displayed, I want to be able to tweak a little the database select in order to select only a subset of items from the table.

3

3 Answers

5
votes
config:
  list:
    table_method: getForAdminList

Then, in a related model table class you can define your conditions to filter records:

  public function getForAdminList()
  {        
    $q = $this->createQuery('a')
      ->where('a.id > ?', 100);
    return $q;
  }

Notice that you have to return the query, not a collection of records.

0
votes

Typically you wouldn't modify the DB call, but would instead change what is shown by editing the generator.yml file.

The part you should be interested in is

config:
  list:
    display: [fields, to, display]
0
votes

In /backend/modules/*module_name*/actions/action.class.php you can override the default admin methods of that module (like in frontend). If you want to filter all querys you can override the getFilters() method and add the default param like:

class firmaActions extends autoFirmaActions
{
    protected function getFilters(){
        $filters = parent::getFilters();
        $filters['level_id'] = '3';
        return $filters;
    }
}

If you want to take a look of autoModuleActions you can find it in cache/backend/modules/autoModule/actions