Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@
</kendo-grid-column>
<!-- FILE -->
<kendo-grid-column
[field]="field.name"
[title]="field.title"
*ngIf="field.type === 'JSON' && field.meta.type === 'file'"
[columnMenu]="false"
Expand Down Expand Up @@ -762,6 +763,7 @@
>
<!-- QUESTION ROWS ( matrix / matrixdropdown ) -->
<kendo-grid-column
[title]="field.title"
[columnMenu]="false"
[width]="field.width"
[hidden]="field.hidden"
Expand All @@ -786,7 +788,8 @@
: field.meta.items
"
>
<kendo-grid-column
<kendo-grid-column
[field]="field.name"
[title]="column.label"
[columnMenu]="false"
[width]="field.width"
Expand Down
29 changes: 18 additions & 11 deletions libs/shared/src/lib/components/ui/core-grid/grid/grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,15 +901,16 @@ export class GridComponent
// Set the width of fixed width columns
const fixedWidthColumns = this.columns.filter(
(column) =>
this.fields.find((field) => field.name === column.field)?.fixedWidth
this.fields.find(
(field) => field.name === column.field && !column.hidden
)?.fixedWidth
);
fixedWidthColumns.forEach(
(column) =>
(column.width = this.fields.find(
(field) => field.name === column.field
).fixedWidth)
);

/** Subtract the width of non-fields columns (details, actions etc.), columns with fixed width and small calculation errors ( border + scrollbar ) */
const gridTotalWidth =
gridElement.offsetWidth -
Expand All @@ -918,11 +919,7 @@ export class GridComponent
12;
// Get all the columns with a title or that are not hidden from the grid
const availableColumns = this.columns.filter(
(column) =>
!column.hidden &&
!!column.title &&
!column.sticky &&
!fixedWidthColumns.includes(column)
(column) => !column.hidden && !!column.title && !column.sticky
);
// Verify what kind of field is and deal with this logic
const typesFields: {
Expand All @@ -931,9 +928,17 @@ export class GridComponent
title: string;
}[] = [];
this.fields.forEach((field: any) => {
const availableFields = availableColumns.filter(
(column: any) => column.field === field.name
);
const availableFields = availableColumns.filter((column: any) => {
// To correctly size referenceData columns when hiding / show them
if (
field.meta.type === 'referenceData' &&
field.meta[column.field.split(field.name + '.')[1]]
) {
return true;
} else {
return column.field === field.name;
}
});
// should only add items to typesFields if they are available in availableColumns
if (availableFields.length > 0) {
typesFields.push({
Expand Down Expand Up @@ -974,7 +979,9 @@ export class GridComponent
break;
}
case 'file': {
contentSize = data[type.field][0]?.name?.length || 0;
contentSize = data[type.field]
? data[type.field][0]?.name?.length
: 0;
break;
}
case 'numeric': {
Expand Down