You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2019/06/12 21:28:43 UTC
[myfaces-tobago] 03/03: TOBAGO-1633: TS refactoring: sheet:
scrollbar-size
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 9d934ea43137cc6d7abe31c2c8599ffb2053085c
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Jun 12 23:28:30 2019 +0200
TOBAGO-1633: TS refactoring: sheet: scrollbar-size
---
.../src/main/npm/ts/tobago-sheet.ts | 26 ++++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-sheet.ts
index 32c111b..e262a8b 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-sheet.ts
@@ -23,6 +23,7 @@ import ClickEvent = JQuery.ClickEvent;
class Sheet {
static readonly SHEETS: Map<string, Sheet> = new Map<string, Sheet>();
+ static readonly SCROLL_BAR_SIZE: number = Sheet.getScrollBarSize();
id: string;
@@ -64,7 +65,7 @@ class Sheet {
addHeaderFillerWidth() {
const last = document.getElementById(this.id).querySelector(".tobago-sheet-headerTable col:last-child");
if (last) {
- last.setAttribute("width", String(Sheet.getScrollBarSize()));
+ last.setAttribute("width", String(Sheet.SCROLL_BAR_SIZE));
}
};
@@ -406,7 +407,6 @@ class Sheet {
action = sheet.id + ":" + rowIndex + ":" + clickActionId;
}
if (clickExecuteIds && clickExecuteIds.length > 0) {
- //Tobago.reloadComponent($target.get(0), clickReloadComponentId, action)
jsf.ajax.request(
action,
event,
@@ -416,7 +416,7 @@ class Sheet {
render: clickRenderIds
});
} else {
- Tobago4.submitAction($(row), action);
+ Tobago4.submitAction(row, action);
}
}
}
@@ -496,10 +496,22 @@ class Sheet {
return document.getElementById(this.id + Tobago4.SUB_COMPONENT_SEP + "scrollPosition");
};
- static getScrollBarSize = function (): number {
- const $outer = $('<div>').css({visibility: 'hidden', width: 100, overflow: 'scroll'}).appendTo('body'),
- widthWithScroll = $('<div>').css({width: '100%'}).appendTo($outer).outerWidth();
- $outer.remove();
+ static getScrollBarSize() {
+ const body = document.getElementsByTagName("body").item(0);
+
+ const outer = document.createElement("div");
+ outer.style.visibility = "hidden";
+ outer.style.width = "100px";
+ outer.style.overflow = "scroll";
+ body.append(outer);
+
+ const inner = document.createElement("div");
+ inner.style.width = "100%";
+ outer.append(inner);
+ const widthWithScroll = inner.offsetWidth;
+
+ body.removeChild(outer);
+
return 100 - widthWithScroll;
};