IDEMPIERE-5024 Horizontal scrolling anomaly (#967)

This commit is contained in:
hengsin 2021-11-05 19:24:17 +08:00 committed by GitHub
parent f755426ba0
commit cbb3bf6614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 26 deletions

View File

@ -48,7 +48,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
<javascript-module name="jawwa.atmosphere" version="202110220730"/> <javascript-module name="jawwa.atmosphere" version="202110220730"/>
<javascript-module name="adempiere.local.storage" version="202011151100"/> <javascript-module name="adempiere.local.storage" version="202011151100"/>
<javascript-moudle name="html2canvas" version="1.3.1"/> <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="jquery.maskedinput" version="1.4.1" />
<javascript-module name="photobooth" version="0.7-rsd3" /> <javascript-module name="photobooth" version="0.7-rsd3" />
<javascript-module name="chosenbox" version="202012041500"/> <javascript-module name="chosenbox" version="202012041500"/>

View File

@ -14,36 +14,84 @@ window.idempiere.scrollToRow = function(uuid){
}; };
//overload for recalculate width of grid frozen scroll //overload for recalculate width of grid frozen scroll
//base on _onSizeLater(wgt) from Frozen.js
window.idempiere.syncScrollFrozen = function(wgt){ window.idempiere.syncScrollFrozen = function(wgt){
var parent = wgt.parent; var parent = wgt.parent;
if (parent.eheadtbl && parent._nativebar) { if (parent.eheadtbl && parent._nativebar) {
var scroll = wgt.$n('scrollX'); var cells = parent._getFirstRowCells(parent.eheadrows),
var cells = parent._getFirstRowCells(parent.eheadrows); head = parent.head,
var frozens = wgt._columns; totalcols = cells.length - jq(head).find(head.$n('bar')).length,
columns = wgt._columns,
var frozenWidth = 0; leftWidth = 0;
for (var i = 0; i < frozens; i++)
frozenWidth += cells[i].offsetWidth; //B70-ZK-2553: one may specify frozen without any real column
if (!cells || totalcols <= 0) {
var bodyWidth = parent.$n('body').offsetWidth; //no need to do the following computation since there is no any column
var availableWidth = bodyWidth - frozenWidth; return;
var totalWidth = 0;
var toScroll = 0;
for (var i = frozens; i < cells.length; i++){
totalWidth += cells[i].offsetWidth;
} }
for (var i = frozens; i < cells.length; i++){
totalWidth -= cells[i].offsetWidth; for (var i = columns; i < totalcols; i++) {
toScroll++; var n = cells[i],
if (totalWidth <= availableWidth) { hdWgt = zk.Widget.$(n),
break; 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) for (var i = 0; i < columns; i++)
scroll.firstChild.style.width = jq.px0(availableWidth+(toScroll * 50)); 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 ()
} }