[{
boxNoFrom: 1,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
{
boxNoFrom: 13,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
},
{
boxNoFrom: 14,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
},
{
boxNoFrom: 22,
boxs: [{…}],
color: "ESPRESSO",
size: "3X"
style: "ZIP UP"
},
{
boxNoFrom: 178,
boxs: [{…}],
color: "ESPRESSO",
size: "XXL"
style: "ZIP UP"
},
{
boxNoFrom: 198,
boxs: [{…}],
color: "ESPRESSO",
size: "XXS",
style: "ZIP UP"
},
{
boxNoFrom: 206,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
},
{
boxNoFrom: 203,
boxs: [{…}],
color: "ESPRESSO",
size: "XXS",
style: "ZIP UP"
}]
How to categorize data based on color/size/style
? For instance, grouping items with the same color, size, and style. It is necessary to rearrange the order accordingly. The boxNoFrom 206
should follow after the boxNoFrom 14
, and boxNoFrom 203
will come after boxNoFrom: 198
.
Here is an example:
[{
boxNoFrom: 1,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
{
boxNoFrom: 13,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
},
{
boxNoFrom: 14,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
},
{
boxNoFrom: 206,
boxs: [{…}],
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
}
{
boxNoFrom: 22,
boxs: [{…}],
color: "ESPRESSO",
size: "3X"
style: "ZIP UP"
},
{
boxNoFrom: 178,
boxs: [{…}],
color: "ESPRESSO",
size: "XXL"
style: "ZIP UP"
},
{
boxNoFrom: 203,
boxs: [{…}],
color: "ESPRESSO",
size: "XXS",
style: "ZIP UP"
}]
If a new boxNoFrom
matches the same color, size, and style, it should be placed sequentially following the previous one. For example, if a new boxNoFom
with number 204
shares the attributes:
color: "ESPRESSO",
size: "2X",
style: "ZIP UP"
it will be positioned after 203
.