Design
Sorting arrays
Sort your data
COMMUNITY FEATURE
Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
v2.0+
Ascendant sort
Carbone allows to use attributes of objects instead of the reserved iterator i
to iterate over arrays. This can be used to sort data directly in the template.
In this example, all cars are first sorted by power
in ascending order, and if two items have the same power value, they are sorted by item position in the array i
.
Multiple sort attributes
Multiples attributes can be used to sort data.
Here is an example to sort the array by power
, sub.size
, and array position i
:
Descendant Sort
Coming soon in Carbone v5