Skip to content

Commit

Permalink
feat(Table): Set default max width for Tabulator columns (#722)
Browse files Browse the repository at this point in the history
- Can be overridden by authoring globalCellSize or column width
#721
  • Loading branch information
breity authored Aug 10, 2022
1 parent 19b94d5 commit aefcf17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/assets/wise5/components/table/TabulatorData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export class TabulatorData {
const defaultOptions = {
layout: 'fitDataTable',
maxHeight: '500px',
reactiveData: true
reactiveData: true,
columnDefaults: {
maxWidth: 200
}
};
this.options = { ...defaultOptions, ...options };
}
Expand All @@ -19,6 +22,7 @@ export class TabulatorData {
export class TabulatorColumn {
title: string;
field: string;
maxWidth: number | boolean; // number of pixels or false for no
width: number | string; // number of pixels or percent of table width (e.g. '20%')
editor: string;
editable: (cell: Tabulator.CellComponent) => boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

.tabulator-header {
font-weight: 500;

.tabulator-col .tabulator-col-content .tabulator-col-title {
white-space: normal;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/assets/wise5/components/table/tabulatorDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class TabulatorDataService {
const width: number = this.getTabulatorColumnWidth(columnDef, globalCellSize);
if (width) {
column.width = width;
column.maxWidth = false;
}
return column;
}
Expand Down

0 comments on commit aefcf17

Please sign in to comment.