Hi,
I have a reusable component that contains a grid but I would like to be able to pass additional <GridColumn /> definitions from consuming components to the reusable component. I'm not sure of the correct way to do this in Typescript. The best way I've come up with so far is to define props for column(s) before and after the fixed content as follows:
preColumns?: React.ReactNode | undefined;
postColumns?: React.ReactNode | undefined;
however in order for this to work properly the consuming component has to pass an array of <GridColumn /> and set a key on each of them e.g.
postColumns={[
<GridColumn key="information" title="Information" width={160} cell={cellHelper.getInformationCell} />,
<GridColumn key="lastUpdatedBy" field="lastUpdatedBy" title="Updated By" width={200} />,
<GridColumn key="lastUpdatedDatetime" field="lastUpdatedDatetime" title="Updated Date" width={250} format={GlobalHelpers.DatetimeFormatForKendo} />,
]}
The disadvantage of this is having to define a key and also that I can't specify a prop for a single column only. Is there a recommended approach in order to achieve this?
Kind regards,
David