Skip to content

Commit 852c5f0

Browse files
committed
fix verticall scroll
1 parent 44236de commit 852c5f0

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

lib/public/components/common/table/table.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ const parseColumnsConfiguration = (columns, currentProfile) => {
8989
* specific configuration. If not specified, any visible column will be displayed
9090
* @property {boolean} horizontalScrollEnabled if true, enable horizontal scroll in case of overflow,
9191
* fixed layout otherwise
92+
* @property {boolean} verticallScrollEnabled if true, enable vertical (table internal) scroll in case of overflow,
93+
* whole page vertical scroll otherwise. Note that for this option to working,
94+
* all predecesors of the node returned by this function must have display property column-flex and height: 100%
9295
*/
9396

9497
/**
@@ -130,6 +133,7 @@ export const table = (
130133
profile: currentProfile = profiles.none,
131134
horizontalScrollEnabled = false,
132135
freezeFirstColumn = false,
136+
verticalScrollEnabled = false,
133137
} = tableConfiguration || {};
134138
const { idKey, displayedColumns } = parseColumnsConfiguration(columns, currentProfile);
135139

@@ -142,18 +146,26 @@ export const table = (
142146
Error(`Unhandled type <${typeof data}> of data : ${data ? JSON.stringify(data) : data}`);
143147
}
144148

145-
return h(`.fitting-table-wrapper${horizontalScrollEnabled ? '.scroll-auto.shadow-level1' : ''}`, h(
146-
`table.table.table-hover.shadow-level1.${freezeFirstColumn ? '.freeze-first-column' : ''}`,
147-
{
148-
style: `table-layout: ${horizontalScrollEnabled ? 'auto' : 'fixed'}`,
149-
},
150-
[
151-
headers(displayedColumns, models),
152-
remoteDataTableBody(
153-
remoteData,
154-
(payload) => rows(payload, idKey, displayedColumns, rowsConfiguration),
155-
displayedColumns.length,
156-
),
157-
],
149+
const scrollEnabled = horizontalScrollEnabled || verticalScrollEnabled;
150+
const wrapperClassesExpression = scrollEnabled ? '.fitting-table-wrapper.scroll-auto' : '';
151+
152+
const optionalTableClassesExpression = freezeFirstColumn && horizontalScrollEnabled ? '.freeze-first-column' : ''
153+
154+
const wrappedTableNode = h(wrapperClassesExpression,
155+
h(`table.table.table-hover.shadow-level1${optionalTableClassesExpression}`,
156+
{
157+
style: `table-layout: ${horizontalScrollEnabled ? 'auto' : 'fixed'}`,
158+
},
159+
[
160+
headers(displayedColumns, models),
161+
remoteDataTableBody(
162+
remoteData,
163+
(payload) => rows(payload, idKey, displayedColumns, rowsConfiguration),
164+
displayedColumns.length,
165+
),
166+
],
158167
));
168+
return scrollEnabled && !verticalScrollEnabled
169+
? h('', wrappedTableNode) // Disable y-scroll
170+
: wrappedTableNode
159171
};

lib/public/views/Runs/Overview/RunsWithQcModel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export class RunsWithQcModel extends RunsOverviewModel {
2626
constructor(model) {
2727
super(model);
2828

29-
this.patchDisplayOptions({ horizontalScrollEnabled: true, freezeFirstColumn: true });
29+
this.patchDisplayOptions({
30+
horizontalScrollEnabled: true,
31+
verticalScrollEnabled: true,
32+
freezeFirstColumn: true,
33+
});
3034
}
3135
}

0 commit comments

Comments
 (0)