Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 $this->Paginator->sort 来生成链接,但是按当前表中没有的字段排序,该字段与该表相关。那我可以这样做吗?以及如何做到这一点?
非常感谢!
对于排序的外部字段,您可以这样做:
<th><?php echo $this->Paginator->sort('ExternalModelName', 'ExternalModelName.fieldname'); ?></th>
但模型关系也必须正确。因此,假设您的关系设置正确,以上将起作用。