Skip to content

[bug]: Column-level readOnly property not working in Data Grid #223

@Joelmmm

Description

@Joelmmm

Describe the bug

The column-level readOnly property specified in column definitions is not being respected by cell variants. While grid-level readOnly works correctly, setting readOnly: true in meta.cell has no effect on preventing cell editing.

How to reproduce

  1. Create a data grid with a column that has readOnly: true in its meta:
sconst columns = [
     {
        id: "trickName",
        accessorKey: "trickName",
        header: "Trick name",
        meta: {
          cell: {
            variant: "short-text",
            readOnly: true,
          },
          // or
          // readOnly: true,
        },
        minSize: 180,
      },
];

const { table, ...dataGridProps } = useDataGrid({
  data,
  columns
});
  1. Try to edit the "Trick name" column
  2. The cell becomes editable despite readOnly: true

Link to reproduction

https://codesandbox.io/p/devbox/k8m4dp

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions