summaryrefslogtreecommitdiffstats
path: root/webapp/src/main.js
diff options
context:
space:
mode:
authorUdo Walter2019-02-23 03:07:07 +0100
committerUdo Walter2019-02-23 03:07:07 +0100
commit558815d4e82e231a267b65de1bbf347a816e22d6 (patch)
tree615b7f207f385a6724a7e87f4cdfef89e9498e5f /webapp/src/main.js
parent[webapp/datatable] code cleanup (diff)
downloadbas-558815d4e82e231a267b65de1bbf347a816e22d6.tar.gz
bas-558815d4e82e231a267b65de1bbf347a816e22d6.tar.xz
bas-558815d4e82e231a267b65de1bbf347a816e22d6.zip
[webapp/datatable] fix filter by selected not working; add filtering indicator
Diffstat (limited to 'webapp/src/main.js')
-rw-r--r--webapp/src/main.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/webapp/src/main.js b/webapp/src/main.js
index cc53b76..6ed1d53 100644
--- a/webapp/src/main.js
+++ b/webapp/src/main.js
@@ -96,21 +96,25 @@ Vue.prototype.$snackbar = function (data) {
// Loop that processes work in chunks to allow the UI to refresh inbetween and prevents freezing.
Vue.prototype.$loop = function (count, chunksize, iteration, callback = () => {}) {
var i = 0
- var breakCondition = false
+ var running = true
const chunk = () => {
- if (breakCondition) return
+ if (!running) return
var end = Math.min(i + chunksize, count)
- for (; i < end; ++i) {
+ for (; i < end; i++) {
iteration(i)
}
if (i < count) {
setTimeout(chunk, 0)
} else {
+ running = false
callback()
}
}
- chunk()
- return { cancel: () => { breakCondition = true } }
+ setTimeout(chunk, 0)
+ const loop = {}
+ Object.defineProperty(loop, 'running', { get: () => running })
+ Object.defineProperty(loop, 'cancel', { value: () => { running = false } })
+ return loop
}
new Vue({