fix entity list resizing

This commit is contained in:
David Back 2018-11-15 15:23:18 -08:00
parent 60c538309a
commit de7f4a4a4d
2 changed files with 6 additions and 16 deletions

View file

@ -1219,7 +1219,7 @@ function loaded() {
refreshSortOrder(); refreshSortOrder();
refreshEntities(); refreshEntities();
window.onresize = updateColumnWidths; window.addEventListener("resize", updateColumnWidths);
}); });
augmentSpinButtons(); augmentSpinButtons();

View file

@ -72,11 +72,6 @@ ListView.prototype = {
} }
}, },
onScroll: function() {
var that = this.listView;
that.scroll();
},
scroll: function() { scroll: function() {
let scrollTop = this.elTableScroll.scrollTop; let scrollTop = this.elTableScroll.scrollTop;
let scrollHeight = this.getScrollHeight(); let scrollHeight = this.getScrollHeight();
@ -244,18 +239,13 @@ ListView.prototype = {
} }
}, },
onResize: function() {
var that = this.listView;
that.resize();
},
resize: function() { resize: function() {
if (!this.elTableBody || !this.elTableScroll) { if (!this.elTableBody || !this.elTableScroll) {
debugPrint("ListView.resize - no valid table body or table scroll element"); debugPrint("ListView.resize - no valid table body or table scroll element");
return; return;
} }
let prevScrollTop = this.elTableScroll.scrollTop; let prevScrollTop = this.elTableScroll.scrollTop;
// take up available window space // take up available window space
this.elTableScroll.style.height = window.innerHeight - WINDOW_NONVARIABLE_HEIGHT; this.elTableScroll.style.height = window.innerHeight - WINDOW_NONVARIABLE_HEIGHT;
@ -305,10 +295,10 @@ ListView.prototype = {
this.elTableBody.appendChild(this.elBottomBuffer); this.elTableBody.appendChild(this.elBottomBuffer);
this.elBottomBuffer.setAttribute("height", 0); this.elBottomBuffer.setAttribute("height", 0);
this.elTableScroll.listView = this; this.onScroll = this.scroll.bind(this);
this.elTableScroll.onscroll = this.onScroll; this.elTableScroll.addEventListener("scroll", this.onScroll);
window.listView = this; this.onResize = this.resize.bind(this);
window.onresize = this.onResize; window.addEventListener("resize", this.onResize);
// initialize all row elements // initialize all row elements
this.resize(); this.resize();