diff --git a/docs/core/components/datatable.component.md b/docs/core/components/datatable.component.md index 21f1d07294..759199c27a 100644 --- a/docs/core/components/datatable.component.md +++ b/docs/core/components/datatable.component.md @@ -601,6 +601,23 @@ widths according to your needs: ![](../../docassets/images/datatable-expand-5.png) +#### No-growing cells + +As mentioned before, in the beginning, all cells have the same width. You can prevent cells from growing by using the `adf-no-grow-cell` class. + +```js +{ + type: 'date', + key: 'created', + title: 'Created On', + cssClass: 'adf-ellipsis-cell adf-no-grow-cell' +} +``` + +Notice that this class is compatible with `adf-ellipsis-cell` and for that reason it has a `min-width` of `100px`. You can override this property in your custom class to better suit your needs. + +![](../../docassets/images/datatable-no-grow-cell.png) + #### Combining classes You can combine the CSS classes described above to customize the table as needed: diff --git a/docs/docassets/images/datatable-no-grow-cell.png b/docs/docassets/images/datatable-no-grow-cell.png new file mode 100644 index 0000000000..ae6ae66d52 Binary files /dev/null and b/docs/docassets/images/datatable-no-grow-cell.png differ diff --git a/lib/core/datatable/components/datatable/datatable.component.scss b/lib/core/datatable/components/datatable/datatable.component.scss index c48181bb02..9c075093b8 100644 --- a/lib/core/datatable/components/datatable/datatable.component.scss +++ b/lib/core/datatable/components/datatable/datatable.component.scss @@ -313,6 +313,11 @@ flex-grow: 5; } + .adf-datatable-cell-header.adf-no-grow-cell, .adf-datatable-cell.adf-no-grow-cell { + flex-grow: 0; + min-width: 100px; + } + .adf-datatable-cell, .adf-datatable-cell-header { flex: 1; padding: 0;