Comments (6)
Hello @ThisIsMyFavouriteJar
You can map on all search results using transformItems
. Here is the documentation about it.
In your case for example you could do something like:
<template>
<!-- ... -->
<ais-hits :transform-items="transformItems" />
</template>
In your methods field
transformItems(items) {
const brands = items.find((item) => item.brand && item.brand.length > 0)
if (brands.length > 0) {
// hide your component
}
return items
},
from meilisearch-vue.
Hi @bidoubiwa , thank you for your answer! Actually I tried this method, but somehow it appears that as soon as I change the necessary variables (e.g. this.showBrands) that Instantsearch automatically makes another request without any filters, thereby immediately negating the change to this.showBrands.
I guess my problem / question is now as follows: How to call a function in 'methods' (where instantMeiliSearch is defined in the data() ) without making another call to Meilisearch?
Hope my answer is clear, and appreciate your help!
from meilisearch-vue.
After some searching I found this:
https://stackoverflow.com/questions/57193330/updating-unrelated-vue-js-variable-causing-input-values-in-template-to-disappear
Turns out that Vue re-renders everything once a variable is updated, in my case causing all original inputs to disappear. Seems to me that this makes it rather hard to use transformItems to get the necessary values......
Edit: It seems the reason everything is rendering again has to do with the way I update my variables. Perhaps this is the way to go after all!
from meilisearch-vue.
Hello @ThisIsMyFavouriteJar
Did you manage to make it work ?
from meilisearch-vue.
Hi @bidoubiwa , unfortunately not yet. The problem seems to be that changing the variable to hide the filter title causes vue to rerender, resetting all search criteria.... Not sure if I am doing things wrong, or if this is just the nature of vue. If you managed to make this work in an earlier project of yours it would be great to hear how you did it!
from meilisearch-vue.
Is your code on an open repo? In case not could you share your instantSearch configuration through a gist?
from meilisearch-vue.
Related Issues (20)
- Make a Vue3 compatibility example HOT 6
- Update .code-samples.meilisearch.yaml
- Example not Working
- Search Issue - Unable to type fast [VUE JS] HOT 4
- Broken link on README HOT 2
- Add Typescript support HOT 2
- Vue widget geosearch leaflet map HOT 6
- Add Vue 3 sample to getting started code sample HOT 1
- Problem with ais-range-slider FACET STATS HOT 3
- ais-refinement-list display data to the user HOT 2
- Refine by specific attribute values HOT 1
- CDN vue-instantsearch plugin does not have the `install` function HOT 2
- Passing query to ais-configure doesnt work. HOT 1
- Error: The "searchParameters" option expects an object. HOT 1
- ais-sort-by is not working as expected HOT 3
- Example of sorting HOT 3
- ais-range-input is not working with meilisearch. HOT 5
- Remove nobel-prize demo
- Problems with search, letters disappear HOT 1
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 meilisearch-vue.