Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramakrishnan24689 authored Aug 1, 2023
1 parent 80c3224 commit eca35de
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions DetailsList/DetailsList/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
SelectionMode,
ThemeProvider,
IDetailsRowProps,
IDetailsColumnProps,
} from '@fluentui/react';
import * as React from 'react';
import { IGridColumn } from './Component.types';
Expand Down Expand Up @@ -380,6 +381,22 @@ function mapToGridColumn(
cellType ? ClassNames.cellTypePrefix + cellType.toString().toLowerCase() : '',
]);

//Set padding-left for headercell
const onRenderHeader: IRenderFunction<IDetailsColumnProps> = (props) => {
if (props) {
return (
<span
style={{
paddingLeft: column.getValue(ColumnsColumns.ColHeaderPaddingLeft) as string,
}}
>
{props.column.name}
</span>
);
}
return null;
};

return {
// Give the column a unique key based on the input collection so changing the columns will recalculate widths etc.
key: 'col' + column.getRecordId(),
Expand Down Expand Up @@ -418,6 +435,7 @@ function mapToGridColumn(
verticalAligned: undefinedIfNullish(column.getValue(ColumnsColumns.ColVerticalAlign)),
horizontalAligned: undefinedIfNullish(column.getValue(ColumnsColumns.ColHorizontalAlign)),
isRowHeader: column.getValue(ColumnsColumns.ColRowHeader) === true,
onRenderHeader: onRenderHeader,
} as IGridColumn;

function undefinedIfNullish<T>(value: T) {
Expand Down

0 comments on commit eca35de

Please sign in to comment.