Comments (3)
+1 looking for conditional option as well.
When you have categories "cars" and "tshirts" you want to show extra filters like "size" "color" when you select tshirts, and show "brand" "fuel" when selecting cars
from searchkit.
A quick fix I'm using is just to wrap the filter in a div and conditionally show or hide the content when the selectedFilters have the id
class HideUnlessFilter extends SearchkitComponent {
getFilters() {
return this.getQuery().getSelectedFilters()
}
hasSelectedFilter() {
const selectedFilter = this.getFilters().filter(f => {
if (f.id === this.props.filterId) { return true }
})
return selectedFilter.length > 0
}
render() {
return (
<div style={{display: (this.hasSelectedFilter() ? 'inherit' : 'none') }}>
{this.props.children}
</div>
)
}
}
<MenuFilter id="region" title="Region" field="location.region.keyword" />
<HideUnlessFilter filterId="region">
<MenuFilter id="store" title="Store" field="location.name.keyword" />
</HideUnlessFilter>
Though one thing I need to fix is making sure the filter is shown if it itself is in the selectedFilters list.
from searchkit.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from searchkit.
Related Issues (20)
- Accessibility features for SearchKit components Inquiry HOT 2
- Access `fields` from the query results
- Add runtime_mappings to the top level of request_body HOT 1
- Can't use sorting HOT 3
- Can you support vue2 version 2.* ? HOT 1
- "Does Searchkit for Vue 2 support or have an implementation of 'searchOnLoad' for creating a manager?" HOT 1
- Not able to implement latest version (4.0.0) of searhkit, earlier had serchkit-carnary version HOT 4
- Is there any GraphQL support? HOT 4
- Cannot connect to SearchKit with ESv8 Security Cert HOT 1
- react-Instantsearch 7.3 issues HOT 1
- Unable to access event listeners for DateRangeFacet in v3 HOT 1
- How to distinct your index ? HOT 2
- Ranking attributes HOT 1
- Algolia v7 API and date filter not working HOT 1
- wrapping SearchKitClient requests with a react component
- Elasticsearch Cloud | Index not getting set correctly HOT 1
- Error: Error transforming Elasticsearch response for index HOT 1
- Change Query / Adjust Query Relevance easily
- Highlight for hierarchical fields not working HOT 6
- Wrong content type: "application/json" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from searchkit.