# sortBy() behaviour changes from 3.2.4 -\> 3.3.2

**URL:** <https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903>\
**Category:** Questions\
**Tags:** v3\
**Created:** [January 17, 2020, 2:44pm UTC](https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903 "2020-01-17T14:44:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [January 17, 2020, 2:44pm UTC](https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903/1 "2020-01-17T14:44:59Z")

</div>

Hi,

I’m in the middle of updating Kirby from 3.2.4 to 3.3.2, and I noticed a change in behaviour in the `$pages->sortBy()` function:

Consider following structure:

```auto
parent-page
|-- 1_child-page-e (⭐️)
|-- 2_child-page-d
|-- 3_child-page-c (⭐️)
|-- 4_child-page-b
|-- 5_child-page-a

```

Each child page has a boolean “status”-field. c & e have status `true` (⭐). In previous Kirby upon applying `page("parent-page")->children()->sortBy("statusfield", "asc")` this was the outcome:

- 1\_child-page-e (⭐)
- 3\_child-page-c (⭐)
- 2\_child-page-d
- 4\_child-page-b
- 5\_child-page-a

but in 3.3.2 this seems to get **reordered alphabetically** first:

- 3\_child-page-c (⭐)
- 1\_child-page-e (⭐)
- 5\_child-page-a
- 4\_child-page-b
- 2\_child-page-d

This is not what I want. I want the **manually sorted order to persist** when the sortby happens (status first). Any clues how?

---

<div class="post-metadata">

**Author:** ![lukaskleinschmidt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukaskleinschmidt/32/13388_2.png) [@lukaskleinschmidt](https://forum.getkirby.com/u/lukaskleinschmidt)\
**Post date:** [January 17, 2020, 3:13pm UTC](https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903/2 "2020-01-17T15:13:44Z")

</div>

Not testet. But something like this should work:

```auto
page("parent-page")->children()->sortBy("statusfield", "asc", "num", "asc");

```

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [January 17, 2020, 3:19pm UTC](https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903/3 "2020-01-17T15:19:19Z")

</div>

`page()->sortBy("order", "asc")->sortBy("statusfield", "asc")` seem to do the trick, but this seems so superfluous to me. Is this a regression?

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [January 17, 2020, 8:37pm UTC](https://forum.getkirby.com/t/sortby-behaviour-changes-from-3-2-4-3-3-2/16903/4 "2020-01-17T20:37:02Z")

</div>

Added an issue: [https://github.com/getkirby/kirby/issues/2398](https://github.com/getkirby/kirby/issues/2398)
