Skip to content

Instantly share code, notes, and snippets.

@petyosi
Created February 9, 2018 13:57
Show Gist options
  • Save petyosi/faf2a69e17d6d7853abac63b3ac57390 to your computer and use it in GitHub Desktop.
Save petyosi/faf2a69e17d6d7853abac63b3ac57390 to your computer and use it in GitHub Desktop.
<template>
<slider :min="min" :max="max" :step="step" :initialValue="initialValue" @valueChanged="filterValueChanged"></slider>
</template>
<script>
import Vue from "vue";
import Slider from './SliderComponent.vue';
export default Vue.extend({
name: 'slider-filter',
data() {
return {
value: 0,
valueGetter: null,
min: null,
max: null,
step: null,
initialValue: null
}
},
components: {
Slider
},
methods: {
isFilterActive() {
return true;
},
doesFilterPass(params){
return this.valueGetter(params.node) <= this.value;
},
getModel() {
return {value: this.value};
},
setModel(model) {
this.value = model.value;
},
filterValueChanged(value) {
this.value = value;
this.params.filterChangedCallback();
}
},
created() {
this.valueGetter = this.params.valueGetter;
this.min = this.params.min;
this.max = this.params.max;
this.step = this.params.step;
this.initialValue = this.params.initialValue;
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment