Skip to content
Snippets Groups Projects
Commit 766cb631 authored by Karl Prieb's avatar Karl Prieb Committed by Guilherme Gazzo
Browse files

Regression: Directory user table infinite scroll doesn't working (#11200)

parent d292a37a
No related branches found
No related tags found
No related merge requests found
......@@ -4,25 +4,19 @@ Template.table.onRendered(function() {
const dummyTr = '<tr class="table-tr-dummy"></tr>';
this.$('tbody').prepend(dummyTr).append(dummyTr);
const onResize = this.data.onResize;
if (onResize) {
onResize();
$(window).on('resize', onResize);
this.onResize = this.data.onResize;
if (this.onResize) {
this.onResize();
$(window).on('resize', this.onResize);
}
});
Template.table.events({
'click tbody tr'(e, t) {
const onItemClick = t.data.onItemClick;
return onItemClick && onItemClick(this);
},
'scroll .table-scroll': _.debounce((e, t) => {
const onScroll = t.data.onScroll;
Template.table.onDestroyed(function() {
$(window).on('off', this.onResize);
});
return onScroll && onScroll(e.currentTarget);
}, 300),
'click .js-sort'(e, t) {
t.data.onSort(e.currentTarget.dataset.sort);
}
Template.table.events({
'click tbody tr'(e, t) { t.data.onItemClick && t.data.onItemClick(this); },
'scroll .table-scroll': _.debounce((e, t) => t.data.onScroll && t.data.onScroll(e.currentTarget), 300),
'click .js-sort'(e, t) { t.data.onSort(e.currentTarget.dataset.sort); }
});
......@@ -107,7 +107,7 @@ Template.directory.helpers({
},
onTableScroll() {
const instance = Template.instance();
if (instance.loading || instance.end.get()) {
if (instance.isLoading.get() || instance.end.get()) {
return;
}
return function(currentTarget) {
......@@ -182,10 +182,6 @@ Template.directory.onRendered(function() {
});
});
Template.directory.onDestroyed(function() {
$(window).on('off', this.resize);
});
Template.directory.onCreated(function() {
this.searchText = new ReactiveVar('');
this.searchType = new ReactiveVar('channels');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment