Verwenden Sie Propel, um im Symfony Admin Generator nach Fremdschlüssel oder benutzerdefinierter Spalte zu sortieren
淡淡烟草味2017-05-16 16:46:10
0
1
584
Sortieren nach Fremdschlüssel oder benutzerdefinierter Spalte im Symfony Admin Generator verwenden Sie Propel. Wie kann ich die benutzerdefinierten Spalten auf der Admin-Listenseite aktivieren, damit sie auch Sortierfunktionen haben?
自己找到方法了,分享一下。
Sorting On A Virtual Column
=================================
The new theme provides an easy way to make virtual columns and foreign key columns sortable in the list view. Just declare the corresponding fields with is_sortable to true, and the generated module will look for an orderByXXX() method in the generated query. For instance, to allow a book list to be sortable on the author name:
Then the generator will try to execute BookQuery::orderByAuthor() whenever the user clicks on the Author header to sort on this column. The method must be implemented as follows:
You can override the default sorting method name for a field by setting the sort_method parameter:
自己找到方法了,分享一下。
Sorting On A Virtual Column
=================================
The new theme provides an easy way to make virtual columns and foreign key columns sortable in the list view. Just declare the corresponding fields with
is_sortable
totrue
, and the generated module will look for anorderByXXX()
method in the generated query. For instance, to allow a book list to be sortable on the author name:Then the generator will try to execute
BookQuery::orderByAuthor()
whenever the user clicks on theAuthor
header to sort on this column. The method must be implemented as follows:You can override the default sorting method name for a field by setting the
sort_method
parameter: