diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs b/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs index 687e0d246..b6aa4ed87 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs @@ -147,7 +147,7 @@ namespace Orchard.Projections.Services { var groupQuery = _contentManager.HqlQuery().Where(alias => alias.Named("ci"), x => x.InG("Id", ids)); // iterate over each sort criteria to apply the alterations to the query object - foreach (var sortCriterion in queryRecord.SortCriteria) { + foreach (var sortCriterion in queryRecord.SortCriteria.OrderBy(s => s.Position)) { var sortCriterionContext = new SortCriterionContext { Query = groupQuery, State = FormParametersHelper.ToDynamic(sortCriterion.State) @@ -210,7 +210,7 @@ namespace Orchard.Projections.Services { } // iterate over each sort criteria to apply the alterations to the query object - foreach (var sortCriterion in sortCriteria) { + foreach (var sortCriterion in sortCriteria.OrderBy(s => s.Position)) { var sortCriterionContext = new SortCriterionContext { Query = contentQuery, State = FormParametersHelper.ToDynamic(sortCriterion.State) @@ -240,4 +240,4 @@ namespace Orchard.Projections.Services { } } } -} \ No newline at end of file +}