0

我一直在寻找一种方法来覆盖基于主键的默认数据排序。

我从文档中找到了一些用于对数据进行排序的配置示例,但它不起作用。

它说

“easy_admin.list”下无法识别的选项“sort”

easy_admin:
   entities:
      Customer:
          class: AppBundle\Entity\Customer
          list:
              sort: 'name'
          form:
              title: 'Add Customer'
              form_options: {validation_groups:['Default']}

              fields:
                  - name
                  - {property: 'gender', type: 'choice', type_options:
                                                  {
                                                    placeholder: 'Select your gender',
                                                    choices: {
                                                        Female: 'female',
                                                        Male: 'male'
                                                    }
                                                  } }
                  - {property: 'birthdate', type: 'date', type_options: {widget: 'single_text'}}
                  - isActive
          new:
              form_options: {validation_groups: ['Default','Customer']}
          edit:
              title: 'Edit Customer'

site_name: 'Premiere Sales'
4

2 回答 2

1

sort在错误的地方使用选项。您应该sort在您的实体配置范围下设置选项:

easy_admin:
    entities:
        User:
            # ...
            list:
                # if the sort order is not specified, 'DESC' is used
                sort: 'createdAt'
于 2017-11-18T11:29:42.773 回答
-1

看来我上面发布的配置是正确的,我刚刚重新启动了服务器和浏览器,它工作正常

于 2017-11-18T15:23:59.730 回答