appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 471 forks source link

FeatureRequest: Separate sorting into its own component #258

Open davidklebanoff opened 6 years ago

davidklebanoff commented 6 years ago

Issue Type: enhancement

Description: Currently, to the best of my knowledge, the sorting features are embedded in the result components. Perhaps it should be moved into a separate components for added flexibility/customizability?

Interestingly enough, on the ReactiveSearch homepage there is a picture showing a "sort by" dropdown beside the search form. Is this ability supported out of the box or is it a custom component?

image

metagrover commented 6 years ago

Related #261

metagrover commented 6 years ago

Update: If you wish to implement sorting as a separate component, we recommend you to create a react dropdown component for showing sort options and utilise the defaultQuery prop of the ReactiveList (or any result component).

The trick is to update the defaultQuery (containing sort query based on the active selection) prop of the result component whenever there is a change in the value of your sort dropdown component.

Hope this helps! I will also attach a demo app here in the comments sometime later for ease.

davidklebanoff commented 6 years ago

@metagrover - Got it. A demo would be great!

marcelchastain commented 4 years ago

I will also attach a demo app here in the comments sometime later for ease.

@metagrover wanted to follow up on this -- I've been having the toughest time getting this to work locally -- is there any way you can post a working example here please? 🙏

It would be a huge help!!