Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/documentation/docs/controls/ListView.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ The `IViewField` has the following implementation:
| minWidth | number | no | Specify the minimum width of the column. |
| maxWidth | number | no | Specify the maximum width of the column. |
| isResizable | boolean | no | Determines if the column can be resized. |
| isMultiline | boolean | no | Determines if the column should be rendered as multiline. Has no effect when a custom `render` function is provided. |
| render | function | no | Override how the field has to get rendered. |

The `IGrouping` has the following implementation:
Expand Down
4 changes: 4 additions & 0 deletions src/controls/listView/IListView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export interface IViewField {
* Determines if the column can be resized.
*/
isResizable?: boolean;
/**
* Determines if the column should be rendered as multiline.
*/
isMultiline?: boolean;
/**
* Override the render method of the field
*/
Expand Down
9 changes: 9 additions & 0 deletions src/controls/listView/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const classNames = mergeStyleSets({
wrapper: {
height: '50vh',
position: 'relative'
},
multilineCell: {
whiteSpace: 'break-spaces'
}
});

Expand Down Expand Up @@ -389,6 +392,12 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
return <a href={item[field.linkPropertyName]}>{item[column.fieldName]}</a>;
};
}

if (field.isMultiline) {
return (item: any, index?: number, column?: IColumn) => { // eslint-disable-line @typescript-eslint/no-explicit-any
return <span className={classNames.multilineCell}>{item[column.fieldName]}</span>;
};
}
}

/**
Expand Down