I've found that it doesn't seem to be possible to create a Container GridColumn component. For example:
https://stackblitz.com/edit/react-5wjdz4?file=app/main.js
Here I want to create a column which has a button that pops up an alert when clicked. When I do so with the following code, it works fine:
<
Column
title
=
"Alert"
width
=
"75px"
cell={(props) => <
td
><
button
onClick={() => alert('This is a message')}>Alert</
button
></
td
>} />
However, I don't want to include the cell, etc. props every time I want to include a column like this in a grid. I'd much rather create a container component I can just pass the message to:
<
AlertColumn
message
=
"This is a message from a container component"
/>
With the component class code being:
class AlertColumn extends React.Component {
render() {
<
Column
title
=
"Alert2"
width
=
"75px"
cell={() => <
td
><
button
onClick={() => alert(this.props.message)}>Alert</
button
></
td
>} />
}
}
However, as you can see from my posted StackBlitz, the column returned by the container component does not render. I've also tried inheriting from the GridColumn component. Is there any way around this?