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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
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]
回答3:
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