IDEMPIERE-5920 Scrollbar in reports (#2109)

* IDEMPIERE-5920 Scrollbar in reports

* IDEMPIERE-5920 Scrollbar in reports

- implement alternative solution using details element
This commit is contained in:
hengsin 2023-11-17 19:31:22 +08:00 committed by GitHub
parent bcbfcbfeb9
commit a8844694bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 11 deletions

View File

@ -861,14 +861,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
String paraWrapId = null; String paraWrapId = null;
if (parameterTable != null) { if (parameterTable != null) {
paraWrapId = cssPrefix + "-para-table-wrap"; paraWrapId = cssPrefix + "-para-table-wrap";
w.print("<div id='" + paraWrapId + "'>"); w.print("<details id='" + paraWrapId + "' open=true style='cursor:pointer'>");
w.print("<summary style='cursor:pointer'>"+Msg.getMsg(getCtx(), "Parameter")+"</summary>");
w.print(compress(parameterTable.toString(), minify)); w.print(compress(parameterTable.toString(), minify));
tr tr = new tr(); tr tr = new tr();
tr.setClass("tr-parameter"); tr.setClass("tr-parameter");
th th = new th();
tr.addElement(th);
th.addElement(Msg.getMsg(getCtx(), "Parameter") + ":");
MQuery query = m_query; MQuery query = m_query;
if (m_query.getReportProcessQuery() != null) if (m_query.getReportProcessQuery() != null)
@ -878,9 +876,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
if (r > 0) { if (r > 0) {
tr = new tr(); tr = new tr();
tr.setClass("tr-parameter"); tr.setClass("tr-parameter");
td td = new td();
tr.addElement(td);
td.addElement("&nbsp;");
} }
td td = new td(); td td = new td();
@ -899,15 +894,16 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
w.print("</table>"); w.print("</table>");
w.print("</div>"); w.print("</details>");
} }
StringBuilder tableWrapDiv = new StringBuilder(); StringBuilder tableWrapDiv = new StringBuilder();
tableWrapDiv.append("<div class='").append(cssPrefix).append("-table-wrap' "); tableWrapDiv.append("<div class='").append(cssPrefix).append("-table-wrap' ");
if (paraWrapId != null) { if (paraWrapId != null) {
tableWrapDiv.append("onscroll=\"if (this.scrollTop > 0) document.getElementById('") String paraWrapGet = "document.getElementById(\""+paraWrapId+"\")";
.append(paraWrapId).append("').style.display='none'; ") tableWrapDiv.append("onscroll='setTimeout(() => {if (this.scrollTop > 0) ")
.append("else document.getElementById('").append(paraWrapId).append("').style.display='block';\""); .append(" if(").append(paraWrapGet).append(".open) ")
.append(paraWrapGet).append(".open=false;}, 100)'");
} }
tableWrapDiv.append(" >"); tableWrapDiv.append(" >");