inveniosoftware / react-searchkit

React component library for interacting with a REST API.
https://inveniosoftware.github.io/react-searchkit/
MIT License
78 stars 40 forks source link

Custom Bucket Rendering #264

Open ThomasJejkal opened 4 months ago

ThomasJejkal commented 4 months ago

Package version (if known): v2.2.5

Describe the bug

I'm not sure whether it is justified to file a bug in this regard, but there seem to be a mismatch between documentation and code, which might be easy to fix. While evaluating react-searchkit for our purposes, I arrived at the point where I wanted to customize bucket rendering to support enhanced aggregations (namely ISO-date-time ranges). I've checked this documentation page and was a bit disappointed that in the "Usage when overriding" section no implementation for BucketAggregationContainer and MyBucketAggregationValues could be found, not even a very basic one.

So I decided to work with the elasticsearch demo, as it should contain an example for that scenario. Unfortunately, I realized, that the demo uses the properties 'renderValuesContainerElement' and 'renderValueElement' of BucketAggregation instead, which seem to be not available in version 2.2.5 anymore (I found them in version 1.X).

Now I'm wondering if it would be possible, to provide an easy example based on the demo code, which is working with the current version?

Many thanks in advance.

ntarocco commented 1 month ago

The BucketAggregationContainer.element takes only one param valuesCmp (see source code here): it is useful when you need to override the default HTML content of the container containing the list of buckets. Indeed, the documentation should describe an example, we will fix that.