IDEMPIERE-5024 Horizontal scrolling anomaly (#967)
This commit is contained in:
parent
f755426ba0
commit
cbb3bf6614
|
@ -48,7 +48,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
<javascript-module name="jawwa.atmosphere" version="202110220730"/>
|
||||
<javascript-module name="adempiere.local.storage" version="202011151100"/>
|
||||
<javascript-moudle name="html2canvas" version="1.3.1"/>
|
||||
<javascript-module name="org.idempiere.commons" version="202107060204"/>
|
||||
<javascript-module name="org.idempiere.commons" version="202111051000"/>
|
||||
<javascript-module name="jquery.maskedinput" version="1.4.1" />
|
||||
<javascript-module name="photobooth" version="0.7-rsd3" />
|
||||
<javascript-module name="chosenbox" version="202012041500"/>
|
||||
|
|
|
@ -14,36 +14,84 @@ window.idempiere.scrollToRow = function(uuid){
|
|||
};
|
||||
|
||||
//overload for recalculate width of grid frozen scroll
|
||||
//base on _onSizeLater(wgt) from Frozen.js
|
||||
window.idempiere.syncScrollFrozen = function(wgt){
|
||||
var parent = wgt.parent;
|
||||
|
||||
var parent = wgt.parent;
|
||||
if (parent.eheadtbl && parent._nativebar) {
|
||||
var scroll = wgt.$n('scrollX');
|
||||
var cells = parent._getFirstRowCells(parent.eheadrows);
|
||||
var frozens = wgt._columns;
|
||||
|
||||
var frozenWidth = 0;
|
||||
for (var i = 0; i < frozens; i++)
|
||||
frozenWidth += cells[i].offsetWidth;
|
||||
|
||||
var bodyWidth = parent.$n('body').offsetWidth;
|
||||
var availableWidth = bodyWidth - frozenWidth;
|
||||
var totalWidth = 0;
|
||||
var toScroll = 0;
|
||||
for (var i = frozens; i < cells.length; i++){
|
||||
totalWidth += cells[i].offsetWidth;
|
||||
var cells = parent._getFirstRowCells(parent.eheadrows),
|
||||
head = parent.head,
|
||||
totalcols = cells.length - jq(head).find(head.$n('bar')).length,
|
||||
columns = wgt._columns,
|
||||
leftWidth = 0;
|
||||
|
||||
//B70-ZK-2553: one may specify frozen without any real column
|
||||
if (!cells || totalcols <= 0) {
|
||||
//no need to do the following computation since there is no any column
|
||||
return;
|
||||
}
|
||||
for (var i = frozens; i < cells.length; i++){
|
||||
totalWidth -= cells[i].offsetWidth;
|
||||
toScroll++;
|
||||
if (totalWidth <= availableWidth) {
|
||||
break;
|
||||
|
||||
for (var i = columns; i < totalcols; i++) {
|
||||
var n = cells[i],
|
||||
hdWgt = zk.Widget.$(n),
|
||||
isVisible = hdWgt && hdWgt.isVisible();
|
||||
if (!isVisible)
|
||||
continue;
|
||||
if (n.offsetWidth==0 ) {
|
||||
if (hdWgt._origWd && hdWgt._origWd.indexOf('px')>0)
|
||||
n.style.width = hdWgt._origWd;
|
||||
else if (hdWgt._hflexWidth && hdWgt._hflexWidth > 0)
|
||||
n.style.width = jq.px(hdWgt._hflexWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (toScroll > 0)
|
||||
scroll.firstChild.style.width = jq.px0(availableWidth+(toScroll * 50));
|
||||
for (var i = 0; i < columns; i++)
|
||||
leftWidth += cells[i].offsetWidth;
|
||||
|
||||
parent._deleteFakeRow(parent.eheadrows);
|
||||
|
||||
wgt.$n('cave').style.width = jq.px0(leftWidth);
|
||||
var scroll = wgt.$n('scrollX'),
|
||||
width = parent.$n('body').offsetWidth;
|
||||
|
||||
// B70-ZK-2074: Resize forzen's width as meshwidget's body.
|
||||
parent.$n('frozen').style.width = jq.px0(width);
|
||||
width -= leftWidth;
|
||||
scroll.style.width = jq.px0(width);
|
||||
var rightWidth = 0;
|
||||
var toScroll = 0;
|
||||
for (var i = columns; i < cells.length; i++){
|
||||
var hdWgt = zk.Widget.$(cells[i]);
|
||||
var isVisible = hdWgt && hdWgt.isVisible();
|
||||
if (!isVisible)
|
||||
continue;
|
||||
if (cells[i].offsetWidth==0) {
|
||||
if (hdWgt._origWd && hdWgt._origWd.indexOf('px')>0)
|
||||
rightWidth += parseInt(hdWgt._origWd,10);
|
||||
else if (hdWgt._hflexWidth && hdWgt._hflexWidth > 0)
|
||||
rightWidth += hdWgt._hflexWidth;
|
||||
|
||||
} else {
|
||||
rightWidth += cells[i].offsetWidth;
|
||||
}
|
||||
}
|
||||
for (var i = columns; i < cells.length; i++){
|
||||
var ow=cells[i].offsetWidth;
|
||||
if (ow==0) {
|
||||
var hdWgt = zk.Widget.$(cells[i]);
|
||||
if (hdWgt._origWd && hdWgt._origWd.indexOf('px')>0)
|
||||
ow = parseInt(hdWgt._origWd,10);
|
||||
else if (hdWgt._hflexWidth && hdWgt._hflexWidth > 0)
|
||||
ow = hdWgt._hflexWidth;
|
||||
}
|
||||
rightWidth -= ow;
|
||||
toScroll++;
|
||||
if (rightWidth <= width) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (toScroll > 0) {
|
||||
scroll.firstChild.style.width = jq.px0(width+(toScroll * 50));
|
||||
}
|
||||
}
|
||||
|
||||
wgt.$syncScroll ()
|
||||
wgt.$syncScroll ();
|
||||
}
|
Loading…
Reference in New Issue