A Sort editor enables the content administrator to choose a sort order (sort key and direction) to apply to a list of records.

Within the results list cartridge, this sort order (along with any boost/bury that is configured for the page) is applied to the results list by default when the end user first arrives at a page. If additional sort options are specified for this cartridge, the end user can select an alternate sort order and later return to the default ord ering as specified by the content administrator.

To add a Sort editor:

The following shows an example of a template that includes a sort editor:

{
    "@description": "${template.description}",
    "@group": "MainContent",
    "ecr:createDate": "2016-09-12T17:33:58.542+05:30",
    "@thumbnailUrl": "thumbnail.png",
    "ecr:type": "template",
    "defaultContentItem": {
        "@name": "Results List",
        "relRankStrategy": "",
        "recordsPerPage": "10",
        "sortOption": {
            "@class": "com.endeca.infront.navigation.model.SortOption",
            "label": "Most Sales",
            "sorts": [{
                "@class": "com.endeca.infront.navigation.model.SortSpec",
                "key": "product.analytics.total_sales",
                "descending": false
            }]
        }
    },
    "editorPanel": {
        "editor": "editors/DefaultEditorPanel",
        "children": [
<!-- additional elements omitted from this example -->
            {
                "editor": "editors/SortEditor",
                "propertyName": "sortOption",
                "label": "${property.sortOption.label}",
                "sortOptions": [
                    {
                        "@class": "com.endeca.infront.navigation.model.SortOption",
                        "label": "${property.sortOption.default.label}"
                    },
                    {
                        "@class": "com.endeca.infront.navigation.model.SortOption",
                        "label": "${property.sortOption.sales.label}",
                        "sorts": [{
                            "@class": "com.endeca.infront.navigation.model.SortSpec",
                            "key": "product.analytics.total_sales",
                            "descending": true
                        }]
                    },
                    {
                        "@class": "com.endeca.infront.navigation.model.SortOption",
                        "label": "${property.sortOption.conversionRate.label}",
                        "sorts": [{
                            "@class": "com.endeca.infront.navigation.model.SortSpec",
                            "key": "product.analytics.conversion_rate",
                            "descending": true
                        }]
                    },
                    {
                        "@class": "com.endeca.infront.navigation.model.SortOption",
                        "label": "${property.sortOption.priceAscending.label}",
                        "sorts": [{
                            "@class": "com.endeca.infront.navigation.model.SortSpec",
                            "key": "product.price",
                            "descending": false
                        }]
                    },
                    {
                        "@class": "com.endeca.infront.navigation.model.SortOption",
                        "label": "${property.sortOption.priceDescending.label}",
                        "sorts": [{
                            "@class": "com.endeca.infront.navigation.model.SortSpec",
                            "key": "product.price",
                            "descending": true
                        }]
                    }
                ]
            }
        ]
    },
    "typeInfo": {
        "boostStrata": {"@propertyType": "List"},
        "buryStrata": {"@propertyType": "List"},
        "recordsPerPage": {"@propertyType": "String"},
        "relRankStrategy": {"@propertyType": "String"},
        "sortOption": {"@propertyType": "Item"}
    }
}            

Copyright © Legal Notices