Advanced lists

Filters

To add an interactive filter to a list, add a filter tag with its for attribute to the name of the field by which you'd like to filter. You can also set a default attribute if you'd like the list to be filtered by default. You can provide filters for fields of type bool, date, enum, language and relation.

application/blog/admin.xml
<page section="blog">
    <title>Blog</title>
    
    <content>
        <list for="blogitem">
            <filter for="category">
                <title>Category</title>
            </filter>
        
            <column for="title"/>
            <column for="category"/>
        </list>
    </content>
</page>

To add a search field to a list, add a search tag with its for attribute to the name of the field in which you'd like to search. It's possible to add multiple search tags. Search is supported for fields of type bool, date, enum, language and relation.

application/blog/admin.xml
<page section="blog">
    <title>Blog</title>
    
    <content>
        <list for="blogitem">
            <search for="title"/>
        
            <column for="title"/>
        </list>
    </content>
</page>

Read-only

You can completely disable editability on a list by adding a fixed attribute. This will prevent the user from creating, updating or deleting list items.

application/blog/admin.xml
<list for="comment" fixed="fixed">
    <column for="date"/>
    <column for="author"/>
</list>

Drag-and-drop ordering

Lists relating to entities that do not have a default sorting order in your database schema will be manually sortable by the user through a drag-and-drop interface. To disable this sorting interface, add an order attribute to the entity.

Enabling drag-and-drop ordering currently disables list pagination. Be sure to add a default sorting order to entities with large data sets to avoid performance issues.

Restricting list content

It's possible to limit the displayed records by setting a where attribute on the list. This attribute currently does not support any dynamic parameter binding.

application/blog/admin.xml
<list for="comment" where="is_visible = 1">
    <column for="date"/>
    <column for="author"/>
</list>
Edit this page on GitHub Updated at Mon, Feb 14, 2022