mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 20:31:47 +00:00
Allow tables to be added without a parent panel
This commit is contained in:
parent
881b692c58
commit
4d3a894bcb
@ -66,39 +66,42 @@ var DynamicTable = new Class({
|
|||||||
|
|
||||||
$(this.dynamicTableDivId).addEvent('scroll', scrollFn);
|
$(this.dynamicTableDivId).addEvent('scroll', scrollFn);
|
||||||
|
|
||||||
var resizeFn = function() {
|
// if the table exists within a panel
|
||||||
var panel = $(this.dynamicTableDivId).getParent('.panel');
|
if ($(this.dynamicTableDivId).getParent('.panel')) {
|
||||||
var h = panel.getBoundingClientRect().height - $(this.dynamicTableFixedHeaderDivId).getBoundingClientRect().height;
|
var resizeFn = function() {
|
||||||
$(this.dynamicTableDivId).style.height = h + 'px';
|
var panel = $(this.dynamicTableDivId).getParent('.panel');
|
||||||
|
var h = panel.getBoundingClientRect().height - $(this.dynamicTableFixedHeaderDivId).getBoundingClientRect().height;
|
||||||
// Workaround due to inaccurate calculation of elements heights by browser
|
|
||||||
|
|
||||||
var n = 2;
|
|
||||||
|
|
||||||
while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ?
|
|
||||||
--n;
|
|
||||||
h -= 0.5;
|
|
||||||
$(this.dynamicTableDivId).style.height = h + 'px';
|
$(this.dynamicTableDivId).style.height = h + 'px';
|
||||||
}
|
|
||||||
|
|
||||||
this.lastPanelHeight = panel.getBoundingClientRect().height;
|
// Workaround due to inaccurate calculation of elements heights by browser
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
$(this.dynamicTableDivId).getParent('.panel').addEvent('resize', resizeFn);
|
var n = 2;
|
||||||
|
|
||||||
this.lastPanelHeight = 0;
|
while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ?
|
||||||
|
--n;
|
||||||
|
h -= 0.5;
|
||||||
|
$(this.dynamicTableDivId).style.height = h + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
// Workaround. Resize event is called not always (for example it isn't called when browser window changes it's size)
|
|
||||||
|
|
||||||
var checkResizeFn = function() {
|
|
||||||
var panel = $(this.dynamicTableDivId).getParent('.panel');
|
|
||||||
if (this.lastPanelHeight != panel.getBoundingClientRect().height) {
|
|
||||||
this.lastPanelHeight = panel.getBoundingClientRect().height;
|
this.lastPanelHeight = panel.getBoundingClientRect().height;
|
||||||
panel.fireEvent('resize');
|
}.bind(this);
|
||||||
}
|
|
||||||
}.bind(this);
|
|
||||||
|
|
||||||
setInterval(checkResizeFn, 500);
|
$(this.dynamicTableDivId).getParent('.panel').addEvent('resize', resizeFn);
|
||||||
|
|
||||||
|
this.lastPanelHeight = 0;
|
||||||
|
|
||||||
|
// Workaround. Resize event is called not always (for example it isn't called when browser window changes it's size)
|
||||||
|
|
||||||
|
var checkResizeFn = function() {
|
||||||
|
var panel = $(this.dynamicTableDivId).getParent('.panel');
|
||||||
|
if (this.lastPanelHeight != panel.getBoundingClientRect().height) {
|
||||||
|
this.lastPanelHeight = panel.getBoundingClientRect().height;
|
||||||
|
panel.fireEvent('resize');
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
setInterval(checkResizeFn, 500);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setupHeaderEvents: function() {
|
setupHeaderEvents: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user