3

有这样的 EasyAdmin 捆绑配置,并添加列表字段,其中一些添加标记为可排序,有些则不是。并且无法找到如何制作可排序字段:1)这是来自另一个实体的关系字段。即OtherEntityName.columnName;2)这是自定义生成的字段,即 2 个字段(这里是fullname由实体中firstnamelastname字段组成的)EntityName

easy_admin:
    entities:
        EntityName:
            class: App\Entity\EntityName
            label: EntityName
            list:
                fields:
                    - {property: id, sortable: true}
                    - {property: createdAt, sortable: true}
                    - {property: fullName, sortable: true}
                    - {property: OtherEntityName.columnName, sortable: true}

找不到如何使其可排序,但默认情况下不排序。需要使其管理操作进行排序,而不是默认情况下,如本例所示:

easy_admin:
    entities:
        EntityName:
            class: App\Entity\EntityName
            label: EntityName
            list:
                fields:
                    - {property: id, sortable: true}
                    - {property: createdAt, sortable: true}
                    - {property: fullName, sortable: true}
                    - {property: OtherEntityName.columnName, sortable: true}
                sort: ['createdAt', 'ASC']
4

0 回答 0