Comments (12)
I tried with eui-or-filter and it works well !
But there are some problems with filters selected but hide when you choose others filters.
Is it possible to extract filters selected for deleting them ?
Thanks
from elasticui.
I think what you are looking for is eui-filter-self="false":
https://github.com/YousefED/ElasticUI/blob/master/docs/components.md
from elasticui.
Thanks for your response, like you can see in my first comment, I already use eui-filter-self="false" but it's not the problem.
Example :
I have two TermsAggregation with TermsFilter, one for brand and another for model.
If I choose two brands (Kia and Honda) and in models I choose (Picanto) if I unselected Kia from brand list, I always have Picanto in results from elastic but it's hidden in the select (because I unselected Kia).
So the results are wrong.
I hope this is more understanding.
Thanks,
from elasticui.
Ah. If I understand you correctly you're selecting a filter, which later gets removed from the interface after another selection changes.
When the filter is removed from the interface, you can't "unselected" it anymore, so it stays active in Elasticsearch
I think a good solution would be to make sure the filter is removed automatically when the interface element is removed.
We should be able to achieve this by watching "this.scope.$on('$destroy'" in FilterController, similar to what's already in AggregationController.
Please let me know whether my analysis seems ok
from elasticui.
Yes, it's exactly this.
I already tried to modify FilterController init by watching "this.scope.$on('$destroy'" but without success
this.scope.$on('$destroy', function() {
if (_this.scope.filter.enabled)
_this.scope.filters.remove(_this.scope.filter.filter);
});
It removes all filters even if they are yet in the interface.
If you can help me on this.
Thanks @YousefED
from elasticui.
Hmm your code looks fine to me. If you could provide a simple JSFiddle / online example I'd love to debug it (for example, change the demo)
from elasticui.
Of course no problem.
There is the fiddle http://jsfiddle.net/gonado/1hLr6kzd/20/
And maybe you need the index example for ES
PUT /cars_ex/
PUT cars_ex/transactions/_mapping/
{
"transactions": {
"properties": {
"brand": {
"type": "string",
"fields": {
"raw": { "type": "string", "index": "not_analyzed" }
}},
"model": {
"type": "string",
"fields": {
"raw": { "type": "string", "index": "not_analyzed" }
}}
}
}
}
}
POST /cars_ex/transactions/_bulk
{ "index": {}}
{ "price" : 12100, "title" : "Honda Civic 1.6 120ch i-DTEC Business", "brand" : "Honda", "model" : "Civic" }
{ "index": {}}
{ "price" : 15290, "title" : "Honda CR-V 1.6 i-DTEC 160 Exclusive Navi 4WD AT", "brand" : "Honda", "model" : "CR-V" }
{ "index": {}}
{ "price" : 18000, "title" : "BMW SERIE 1 114D 95CH LOUNGE START EDITION 5P", "brand" : "BMW", "model" : "Série 1" }
{ "index": {}}
{ "price" : 25000, "title" : "BMW SÉRIE 3 316DA 116CH LOUNGE START EDITION", "brand" : "BMW", "model" : "Série 3" }
{ "index": {}}
{ "price" : 7990, "title" : "OPEL KARL 1.0 75CH ESSENTIA", "brand" : "Opel", "model" : "Karl" }
{ "index": {}}
{ "price" : 8990, "title" : "OPEL CORSA 1.2 70CH ESSENTIA 3P", "brand" : "Opel", "model" : "Corsa" }
{ "index": {}}
{ "price" : 14990, "title" : "KIA CEED 1.4 CRDI 90CH MOTION", "brand" : "Kia", "model" : "Ceed" }
{ "index": {}}
{ "price" : 22490, "title" : "KIA CARENS 1.7 CRDI 115CH ACTIVE ISG 5 PLACES", "brand" : "Kia", "model" : "Carens" }
{ "index": {}}
{ "price" : 25900, "title" : "VOLKSWAGEN GOLF SPORTSVAN", "brand" : "Volkswagen", "model" : "Golf Sportsvan" }
Thanks !
from elasticui.
The modification is here
FilterController.prototype.init = function () {
...
this.scope.$on('$destroy', function() {
if (_this.scope.filter.enabled)
_this.scope.filters.remove(_this.scope.filter.filter);
});
};
from elasticui.
Thanks a lot for this. The solution so far doesn't work because the filters always get destroyed and recreated. This makes sense, but unfortunately this means a quick-fix is not readily available (requires more architectural changes).
Another solution might be to create something similar to eui-filter-self="false", but then eui-never-filter="true". This would mean an aggregation (in this case "brands") would never be filtered (would need to update AggregationController.getAggregation()
A quick workaround for your scenario would be to just statically define the brands, instead of via an aggregation. for example something like this for every brand:
<label class="checkbox" eui-filter="ejs.TermsFilter('model.raw', 'BMW')">
<input type="checkbox" ng-model="filter.enabled">
BMW
</label>
Hope this helps for now
from elasticui.
Thanks for your response !
I've already implemented the eui-never-filter, it works great if you want to keep all brands visible.
But you always have the problem with filters get destroyed and present in ES.
This is always a big problem for my scenario, maybe I have to use elastic.js only, but I like to use elasticui, it's so easy to use :-)
Do you think you will make theses changes in the future to adapt elasticui ?
Thanks.
from elasticui.
What is the problem you keep having after implementing this ("always have the problem with filters get destroyed)?
At this moment, I don't have any plans myself to implement this unfortunately.
from elasticui.
Ok no problem I understand !
Implementing the eui-never-filter keep well all brands even if you choose a model, but If you have a model checked and you unchecked a brand of this model it keeps this model in ES, so it's not working !
I have to find a way to do it.
Thanks for you time.
from elasticui.
Related Issues (20)
- multiple items cannot be selected using eui-checklist widget
- Input search does not refresh the search when the clean icon is clicked
- Partial search HOT 1
- Impossible to use more than one searchbox HOT 1
- Top level filter parameter deprecated in ES 5
- checkbox does not filter
- Hello!
- is it possible to use ElasticUI with elasticsearch 5.x? HOT 6
- Has "ElasticUI" been tested with partial files?
- change indexVM.page in controlle HOT 1
- How do I add some logic to eui-query? HOT 1
- Default to AND operator in searchbox HOT 1
- Term Aggregation - Custom order
- Sort HOT 1
- Is it possible to add custom parameter to a url?
- Multilanguage, translate ... change the {{bucket.key}} on the fly
- Access Control with POST/GET/DELETE/...
- Space issue in Single Select and Checkbox HOT 2
- UseCase Searchbox to filter only one facet
- jsfiddle Demo does not work.
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 elasticui.