reset custom component input after clearing from SelectedFilters
doc enhancement Platform: web
Description:
i added a custom reactive component `import React, { Component } from "react"; class ChildInput extends Component { setValue = value => { this.props.setQuery({ query: this.props.query(value), value: value }); }; render() { return (
export default ChildInput;` i wrapped the component inside a ReactiveComponent and it works, it filters the results perfectly but i didn't find how to clear the input field after the clear on the SelectedFilters component is there an event for that ?
Minimal reproduction of the problem with instructions:
Reactivesearch version: 2.6.2"
Anything else: i suggest to add an event to the custom component like "onSelectedFiltersClear"
Since I might have the same issue, I created a sandbox to visualize my problem. When using the ToggleButton I can check/uncheck them and of course reset the filter correctly. Now I do have my own Reactive Component which works correctly when clicking on the stars, BUT will not be reset if you reset the filter.
Updated sandbox. Now catching that selectedValue is null so I set value to 0 and some other dirty workaround (see componentWillReceiveProps in ReactiveStarRatingWrapper) but it's working
Hi @axeff I'm facing a similar issue. I didn't get what dirty workaround you found. Could you explain more pls?
I use a CustomQuery for the DataSearch default component and it does NOT reset when I toggle the "clear all" filter button or when I press its own filter toggle button.
The docs only say:
onClear function [optional]
Gets triggered when the clear all button is clicked.
It's not very clear, and i don't see any examples of this onClear function
Can you point us to an example?
You can use it as:
<SelectedFilters onClear={(comp, val) => console.log(comp, val)} />
@metagrover does the onClear prop work on native? I noticed that the documentation for SelectedFilters for Native doesn't include everything that the Web version has
@dres-cifuentes No, it isn't supported on native yet. It should be very similar to implement though. Open to accepting PR on this :)
@metagrover FYI, the docs (here at least https://opensource.appbase.io/reactive-manual/base-components/selectedfilters.html) Make mention of an onChange, not an onClear
@jyash97 Can you update the docs