Eea.facetednavigation - How does the sorting widget work?

I'm trying to setup a faceted navigation view with sorting as one of the fields, but it won't display the metadata fields I want to sort on.

I have a content type with an interface that has two text line fields Manufacturer and Equipment_Type

I have two Metadata columns Manufacturer and Equipment_Type.

I have a SimpleVocabulary:

@provider(IVocabularyFactory)
def EquipmentSortableColumns(context):
    terms = [SimpleTerm(value='Manufacturer', token='Manufacturer', title='Manufacturer'),
             SimpleTerm(value='Equipment_Type', token='Equipment_Type', title='Equipment Type'),
            ]
    return SimpleVocabulary(terms)

which I register in configure.zcml as 'my.product.equipment_sortable_columns'

I have a container where I setup a faceted navigation view and I have a widget with the type 'Sorting'. In the 'Filter from vocabulary', I place 'my.product.equipment_sortable_columns'. When I try to view the folder, the sorting widget is blank.

Where am I going wrong?

I think you need to do @zope.interface.provider(IVocabularyFactory).

1 Like

Thus, you'll have to add your fields to sortable_indexes registry.

1 Like

The world would be a better place if there was a dedicated configlet for the querystring settings that are now stored in the registry.

1 Like

Sorry, I was copying my code and I forgot to include that provider bit.

Thank you for your help and your time!
Adding it to the registry works.

I see where I misunderstood filter from vocabulary. I apologize.

1 Like

Don't have to apologize. AFAIK there is a vocabulary setting you can use with Sorting widget:

In case you don't want to show all sorting options you can provide a custom vocabulary. This way, you can also customize the labels.

1 Like