1

I'm trying to extend MUI Data Grid column definition to include an additional parameter "multiline".

I have look here: Custom column types and here: [data grid] Add column type to view and edit long text but neither addresses my specific question directly.

What I'm trying to achieve is that in the column definition itself I'd like to add an additional paramemter:

<DataGrid
  columns={[
    { field: 'status', type: 'string', multiline: false },
    { field: 'bio', type: 'string', multiline: true },
    // ...etc
  ]}
  rows={rows}
/>

While I am able to do exactly that, and it works as expected, I'm getting a TypeScript error that multiline doesn't exist on GridBaseColDef.

enter image description here

I tried extending GridBaseColDef:

interface extendedGridColDef extends GridColDef {
  multiline?: boolean;
}

But now I'm getting an error saying that An interface can only extend an object type or intersection of object types with statically known members.

Any advice on how to resolve this?

Michael Seltenreich
  • 3,013
  • 2
  • 29
  • 55

0 Answers0