Skip to content

Business intelligence made simple

Fixed timing issue with preview tables

Andrew Kanef7d5280d4fd8
diff --git a/app/views/blazer/queries/_form.html.erb b/app/views/blazer/queries/_form.html.erb
index 42820b6b..2dcb98e2 100644
--- a/app/views/blazer/queries/_form.html.erb
+++ b/app/views/blazer/queries/_form.html.erb
@@ -114,14 +114,18 @@
},
updateDataSource: function(dataSource) {
this.dataSource = dataSource
- var _this = this
+ var selectize = this.selectize
+ selectize.clearOptions()
+
+ if (this.tablesXhr) {
+ this.tablesXhr.abort()
+ }
- $.getJSON(Routes.tables_queries_path({data_source: this.dataSource}), function(data) {
+ this.tablesXhr = $.getJSON(Routes.tables_queries_path({data_source: this.dataSource}), function(data) {
var newOptions = []
for (var i = 0; i < data.length; i++) {
newOptions.push({text: data[i], value: data[i]})
}
- var selectize = _this.selectize
selectize.clearOptions()
selectize.addOption(newOptions)
selectize.refreshOptions(false)