Wrapper component for DataTable Column component

UI Components for React
Post Reply
jchau
Posts: 3
Joined: 26 Nov 2019, 01:27

26 Nov 2019, 01:33

Is it possible to create a wrapper component for Column component? I tried creating my own component that wraps the PrimeReact DataTable Column component and using my own component inside of a DataTable. However, it never calls my code. Is this because DataTable never actually renders out a Column? Instead, Column is used only for props? I am trying to add certain defaults and helper properties to the Column component to speed up development.

Code: Select all

const DataColumn: React.FC<IDataColumnProps> = (props: IDataColumnProps) => {
    const { style = {}, align, width, ...validProps } = props;
    Object.assign(style, {
        textAlign: align,
        width: width
    });

    return (
        <Column {...validProps} style={style}></Column>
    );
}

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests