This commit is contained in:
2020-03-19 19:02:55 +00:00
parent 71e839877b
commit b5adadd747

View File

@@ -67,8 +67,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */ /* eslint-disable */
//////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
import _ from "../libs/lodash.min.js";
//todo: empty item support //todo: empty item support
//todo: custom filter that works with tags (ignore tag part and filter as normal) //todo: custom filter that works with tags (ignore tag part and filter as normal)
export default { export default {
created() { created() {
//need to add no selection object if specified //need to add no selection object if specified
@@ -135,11 +137,13 @@ export default {
return; return;
} }
} }
console.log("Calling test from watcher");
// this.test();
this.doSearch();
//doSearch(vm, val); //doSearch(vm, val);
//window.$gz._.debounce(doSearch(vm, val), 1300); //window.$gz._.debounce(doSearch(vm, val), 1300);
//debounce and don't search constantly on every keystroke //debounce and don't search constantly on every keystroke
console.log("Calling debounced test...");
this.test();
}, },
value(val) { value(val) {
//this ensures the parent form gets the onchange event //this ensures the parent form gets the onchange event
@@ -154,7 +158,20 @@ export default {
lt: function(ltkey) { lt: function(ltkey) {
return window.$gz.translation.get(ltkey); return window.$gz.translation.get(ltkey);
}, },
doSearch: window.$gz._.debounce(function() { test: _.debounce(function() {
console.log("log from inside debounce");
}, 500),
// test: function() {
// console.log("In test calling debounce...");
// window.$gz._.debounce(function() {
// console.log("log from inside debounce");
// }, 500);
// },
doSearch: _.debounce(function() {
var vm=this;
console.log("Inside Debounced function");
//NOTE debounce with a watcher is a bit different
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
//----------------- //-----------------
//Pre-process the query to validate and send conditionally //Pre-process the query to validate and send conditionally
var val = this.searchEntry; var val = this.searchEntry;
@@ -254,7 +271,7 @@ export default {
}); });
//------------ //------------
}, 1300) }, 500)
}, },
beforeCreate() { beforeCreate() {
//check pre-requisites exist just in case //check pre-requisites exist just in case