简体   繁体   English

Drupal views_embed_view排序

[英]Drupal views_embed_view sorting

I have a Drupal 7 module which includes a database query that gives me a list of jobs id's in a specific order based on calculated distance from a user-inputted location (nearest first, furthest last). 我有一个Drupal 7模块,其中包括一个数据库查询,该查询根据从用户输入的位置(最近的,最远的最近)的计算距离,以特定的顺序为我提供作业ID列表。

I then pass the job id's to views_embed_view as arguments with a contextual filter on the view. 然后,我将作业ID作为参数传递给views_embed_view,并在视图上使用上下文过滤器。 This then displays a list of jobs to the user. 然后,这会向用户显示作业列表。

However, whilst there is no sorting specified within the view, the order gets changed automatically. 但是,尽管视图中未指定排序,但是订单会自动更改。 eg if the order of the records passed to views_embed_view is 10,52,22 it displays in the following order: 10,22,52 ie it gets ordered numerically ascending. 例如,如果传递给views_embed_view的记录的顺序是10,52,22,则它将按以下顺序显示:10,22,52,即,它以数字升序排列。

Any ideas on how to get views_embed_view to stop re-sorting my results? 关于如何获取views_embed_view以停止对我的结果进行重新排序的任何想法?

Just thought I'd post how I solved it in case anyone encounters this issue in future: 只是以为我会发布解决方案,以防将来有人遇到此问题:

A Drupal module called Views Arguments Extras includes a sort handler which allows for the order of items to be based on their order in a multi-value argument: 一个称为Views Arguments Extras的 Drupal模块包括一个排序处理程序,该处理程序允许项目的顺序基于其在多值参数中的顺序:

https://www.drupal.org/project/views_arguments_extras https://www.drupal.org/project/views_arguments_extras

Many thanks to the contributors of this module. 非常感谢这个模块的贡献者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM