You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2024/01/22 09:46:50 UTC
(myfaces-tobago) 01/02: fix(lazy-sheet): change column width
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit c26ef5530b44f5b9af2dd434429a9356c38684ea
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Mon Jan 22 10:19:47 2024 +0100
fix(lazy-sheet): change column width
For a lazy sheet, a column-resizer is rendered. The column-resizer could not be used, except for column one. This is because column one has the layout attribute "auto". All other columns doesn't have a layout attribute set. This fix is to repeat the values of the layout attribute array as long as every column has a layout attribute set.
Issue: TOBAGO-2275
---
tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
index 9af6215667..b703f35812 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-sheet.ts
@@ -97,7 +97,7 @@ export class Sheet extends HTMLElement {
console.info("columnWidths: %s", JSON.stringify(columnWidths));
if (columnWidths && columnWidths.length === 0) { // active, but empty
// otherwise use the layout definition
- const tokens: any[] = JSON.parse(this.dataset.tobagoLayout).columns;
+ let tokens: any[] = JSON.parse(this.dataset.tobagoLayout).columns;
const columnRendered = this.isColumnRendered();
const headerCols = this.getHeaderCols();
@@ -112,6 +112,11 @@ export class Sheet extends HTMLElement {
console.assert(headerCols.length - 1 === bodyCols.length,
"header and body column number doesn't match: %d != %d ", headerCols.length - 1, bodyCols.length);
+ while (tokens.length < headerCols.length - 2) {
+ tokens = [...tokens, ...tokens];
+ }
+ tokens = tokens.slice(0, headerCols.length - 2);
+
let sumRelative = 0; // tbd: is this needed?
let widthRelative = tableWidth;
let r = 0;
@@ -655,10 +660,12 @@ Type: ${data.type}`);
this.getHiddenSelected().value = JSON.stringify(Array.from(selectedSet)); // write back to element
this.fireSelectionChange(oldSelectedSet, selectedSet);
}
+
clickOnColumnSelector(event: MouseEvent): void {
event.stopPropagation();
this.clickOnRow(event);
}
+
clickOnRow(event: MouseEvent): void {
let clickElement: HTMLElement = event.target as HTMLElement;
while (clickElement.tagName !== "TR") {