Is there a way to dictate the hierarchy for what cell override to use for the Grid vs Column cell override?

1 Answer 26 Views
Grid
Jonathon
Top achievements
Rank 1
Jonathon asked on 07 May 2025, 07:09 PM

So assuming a have a Grid with a custom cell override like so:

<Grid
            {...props}
            cells={hidden? { data: HiddenCell } : cells}
            data={hidden? loadingData : data}
></Grid>

 

and the Grid has columns where one column has a custom cell as well

<GridColumn
            {...props}
            cells={{ data: CustomCell }}
></GridColumn>



Is there a way to set the grid so that the custom cell on the Grid overrides the custom cell on the Column?

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 09 May 2025, 12:56 PM

Hi, Jonathon,

In the KendoReact Grid, the GridColumn.cell property has higher specificity than the Grid.cells property. This means that if both are defined, the custom cell defined at the column level will take precedence over the grid-level custom cell. Unfortunately, there isn't a built-in way to reverse this order directly.

However, you can control the rendering logic within your custom cell components to achieve the desired behavior in a similar way:

    const CustomCell = (props) => {
        if (props.useGridCell) {
            return <HiddenCell {...props} />;
        }
        return <td>{props.dataItem[props.field]}</td>;
    };
    
    // Usage in GridColumn
    <GridColumn
        {...props}
        cell={CustomCell}
    />
    

    You can also use state or props to dynamically control the rendering logic, allowing you to switch between the column-level and grid-level custom cells as needed.

    I hope the provided information will be helpful for you.

      Regards,
      Vessy
      Progress Telerik

      Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

      Tags
      Grid
      Asked by
      Jonathon
      Top achievements
      Rank 1
      Answers by
      Vessy
      Telerik team
      Share this question
      or