GridHeaderCell
Component
Definition
Package:@progress/kendo-react-grid
Properties Interface:GridHeaderCellProps
Syntax:
jsx
const App = () => {
const [data, setData] = useState([
{ foo: 'A1', bar: 'B1', b1: 1, b2: 2 },
{ foo: 'A2', bar: 'B2', b1: 3, b2: 4 },
{ foo: 'A3', bar: 'B2', b1: 5, b2: 6 }
]);
const [barDetails, setBarDetails] = useState(false);
const CustomHeaderCell = (props: GridCustomHeaderCellProps) => (
<th
{...props.thProps}
colSpan={1}>
<span>
{props.title || props.field + ' '}
<Button onClick={() => setBarDetails(!barDetails)}>
{barDetails ? 'collapse' : 'expand'}
</Button>
{props.children}
</span>
</th>
);
return (
<Grid style={{ height: '420px' }} data={data} reorderable={true}>
<GridColumn field="foo" />
<GridColumn field="bar" cells={{ headerCell: CustomHeaderCell }}>
{barDetails && [<GridColumn field="b1" />, <GridColumn field="b2" />]}
</GridColumn>
</Grid>
);
};
export default App;
Properties
children
ReactNode
The current sort icons.
The props of the Grid column menu wrapper.
field?
string
The column field in which the cell is located.
onClick?
any
The click event handler of the cell.
The selectionChange event handler of the cell.
The selectionValue event handler of the column in which the cell is located.
title?
string
The title of the column in which the cell is located.