diff --git a/src/components/trays/model-selection/catalogItems.js b/src/components/trays/model-selection/catalogItems.js index 8738988..afad8e0 100644 --- a/src/components/trays/model-selection/catalogItems.js +++ b/src/components/trays/model-selection/catalogItems.js @@ -146,6 +146,9 @@ export default function CatalogItems(data) { } // return all the data cards else { + // get the sorting parameter + const sortParam = (data.isTropical) ? 'advisory_number' : 'cycle'; + // render the results of the data query return ( @@ -172,7 +175,7 @@ export default function CatalogItems(data) { // filter by the group name, get the top 1 .filter((val, idx, self) => ( idx === self.findIndex((t)=> ( t['group'] === val['group']) ))) - .sort((a, b) => a.properties['product_name'] < b.properties['product_name'] ? -1 : 1) + .sort((a, b) => a.properties['product_name'] + a.properties[sortParam] < b.properties['product_name'] + b.properties[sortParam] ? 1 : -1) // output summarized details of each group member .map((mbr, mbrIdx) => ( // create the checkbox