This commit is contained in:
Henry Jordan
2021-09-22 16:37:52 +00:00
parent b5f6097627
commit c8cb129287
4 changed files with 28 additions and 17 deletions

View File

@@ -35,7 +35,7 @@
<b-form-group>
<b-form-checkbox-group
v-model="localSelected"
:options="options"
:options="results"
value-field="key"
text-field="value"
name="flavour-2a"
@@ -60,17 +60,19 @@
<script>
export default {
name: "ProcessPopover",
props: ["target", "options"],
props: ["target"],
data() {
return {
timeCounter:"",
options: [],
text: "",
results: [],
allColumns: false,
localSelected: [],
selected: [],
};
},
mounted() {
this.results = this.options;
this.localSelected = this.selected;
},
methods: {
@@ -80,6 +82,7 @@ export default {
*/
setOptions(options) {
this.options = options;
this.results = options;
},
/**
* Setter the selected options
@@ -115,11 +118,14 @@ export default {
* Search in the column name
*/
search() {
let that = this;
clearTimeout(this.timeCounter);
this.timeCounter = setTimeout(()=>{
that.$emit("onChange", this.text.toLowerCase())
}, 500);
let txt = this.text.toLowerCase(),
val,
opts = [];
opts = _.filter(this.options, function (o) {
val = o.value.toLowerCase();
return val.search(txt) != -1;
});
this.results = opts;
},
/**
* Toogle all options in popover
@@ -131,7 +137,7 @@ export default {
res.push(o.key);
});
}
this.localSelected = res;
this.selected = res;
},
/**
* Handler when change options event