|
|
@ -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; |
|
|
|
|
|
|
|
$(this.dynamicTableDivId).style.height = h + 'px'; |
|
|
|
|
|
|
|
|
|
|
|
// Workaround due to inaccurate calculation of elements heights by browser
|
|
|
|
// Workaround due to inaccurate calculation of elements heights by browser
|
|
|
|
|
|
|
|
|
|
|
|
var n = 2; |
|
|
|
var n = 2; |
|
|
|
|
|
|
|
|
|
|
|
while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ?
|
|
|
|
while (panel.clientWidth != panel.offsetWidth && n > 0) { // is panel vertical scrollbar visible ?
|
|
|
|
--n; |
|
|
|
--n; |
|
|
|
h -= 0.5; |
|
|
|
h -= 0.5; |
|
|
|
$(this.dynamicTableDivId).style.height = h + 'px'; |
|
|
|
$(this.dynamicTableDivId).style.height = h + 'px'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.lastPanelHeight = panel.getBoundingClientRect().height; |
|
|
|
this.lastPanelHeight = panel.getBoundingClientRect().height; |
|
|
|
}.bind(this); |
|
|
|
}.bind(this); |
|
|
|
|
|
|
|
|
|
|
|
$(this.dynamicTableDivId).getParent('.panel').addEvent('resize', resizeFn); |
|
|
|
$(this.dynamicTableDivId).getParent('.panel').addEvent('resize', resizeFn); |
|
|
|
|
|
|
|
|
|
|
|
this.lastPanelHeight = 0; |
|
|
|
this.lastPanelHeight = 0; |
|
|
|
|
|
|
|
|
|
|
|
// Workaround. Resize event is called not always (for example it isn't called when browser window changes it's size)
|
|
|
|
// Workaround. Resize event is called not always (for example it isn't called when browser window changes it's size)
|
|
|
|
|
|
|
|
|
|
|
|
var checkResizeFn = function() { |
|
|
|
var checkResizeFn = function() { |
|
|
|
var panel = $(this.dynamicTableDivId).getParent('.panel'); |
|
|
|
var panel = $(this.dynamicTableDivId).getParent('.panel'); |
|
|
|
if (this.lastPanelHeight != panel.getBoundingClientRect().height) { |
|
|
|
if (this.lastPanelHeight != panel.getBoundingClientRect().height) { |
|
|
|
this.lastPanelHeight = panel.getBoundingClientRect().height; |
|
|
|
this.lastPanelHeight = panel.getBoundingClientRect().height; |
|
|
|
panel.fireEvent('resize'); |
|
|
|
panel.fireEvent('resize'); |
|
|
|
} |
|
|
|
} |
|
|
|
}.bind(this); |
|
|
|
}.bind(this); |
|
|
|
|
|
|
|
|
|
|
|
setInterval(checkResizeFn, 500); |
|
|
|
setInterval(checkResizeFn, 500); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setupHeaderEvents: function() { |
|
|
|
setupHeaderEvents: function() { |
|
|
|