Sort By Foreign Key or Custom Column in Symfony Admin Generator use propel
淡淡烟草味
淡淡烟草味 2017-05-16 16:46:10
[PHP讨论组]

Sort By Foreign Key or Custom Column in Symfony Admin Generator use propel。在admin list页面自定义的列,如何能让他也能有排序功能。

淡淡烟草味
淡淡烟草味

全部回复(1)
PHP中文网

自己找到方法了,分享一下。
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:

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号