• What is KendoReact
  • Getting Started
  • Server Components
  • Components
    • Animation
    • Barcodes
    • Buttons
    • Chartsupdated
    • Common Utilities
    • Conversational UIupdated
    • Data Gridupdated
    • Data Query
    • Data Tools
    • Date Inputs
    • Date Math
    • Dialogs
    • Drawing
    • Dropdownsupdated
    • Editor
    • Excel Export
    • File Saver
    • Formupdated
    • Ganttupdated
    • Gauges
    • Indicators
    • Inputsupdated
    • Labels
    • Layoutupdated
    • ListBox
    • ListView
    • Map
    • Notification
    • OrgChartnew
    • PDF Processing
    • PDFViewer
    • PivotGrid
    • Popup
    • Progress Bars
    • Ripple
    • Scheduler
    • ScrollView
    • Sortable
    • Spreadsheetupdated
    • TaskBoard
    • Tooltips
    • TreeList
    • TreeViewupdated
    • Upload
  • Sample Applications
  • Styling & Themes
  • Common Features
  • Project Setup
  • Knowledge Base
  • Changelog
  • Updates
  • Troubleshooting

GridHeaderCell

A subclass of React.Component.

class App extends React.PureComponent {
   state = {
       details: false,
       data: [
              { foo: 'A1', bar: 'B1', b1: 1, b2:2 },
              { foo: 'A2', bar: 'B2', b1: 3, b2:4 },
              { foo: 'A3', bar: 'B2', b1: 5, b2:6 }
          ]
   };

   CustomHeaderCell = (props) =>
       <span>
           {props.title || props.field + ' '}
           <button onClick={() => this.setState({ barDetails: !this.state.barDetails })}>
               {this.state.barDetails ? 'collapse' : 'expand'}
           </button>
           {props.children}
       </span>

   render() {
       return (
           <Grid
               style={{ height: '420px' }}
               data={this.state.data}
               reorderable={true}
           >
               <GridColumn field="foo" />
               <GridColumn field="bar" headerCell={this.CustomHeaderCell}>
                   {this.state.barDetails && [
                       <GridColumn field="b1" />,
                       <GridColumn field="b2" />
                   ]}
               </GridColumn>
           </Grid>
       );
   }
}

ReactDOM.render(<App />, document.querySelector('my-app'));
NameTypeDefaultDescription

props

Readonly<GridHeaderCellProps>

The props of the GridHeaderCell component.

In this article

Not finding the help you need?