-3

We have integrated the Sonata bundle for our project. We have a requirement to put the ordinary number as the very first field in the list. Items in the list view should be listed by number like I did under column Number on following example

Number    ID      title 
  1       100     title1
  2       101     title2
  3       102     title3

Is it possible to do it?

yivi
  • 42,438
  • 18
  • 116
  • 138
Milos
  • 543
  • 8
  • 15

2 Answers2

0

You can create a new column and set a custom twig template for that field. Inside that twig you can check which page are you currently seeing and make the necessary calculus for that.

See more here: https://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/list_field_definition.html#custom-template

GasKa
  • 663
  • 5
  • 25
0

For Sonata actual order of fields in database is not important, but items on admin page are displayed at order they are added (to $formMapper or $listMapper object).

MilanG
  • 6,994
  • 2
  • 35
  • 64
  • Yeah, I know how Sonata works but I don't' know how to put the basic number in the list view. Items are actually displayed by default filter which we can configure, even then my client wants to see order number (1,2,3,4...) and nothing else – Milos Jul 08 '19 at 10:00