2

How do I create multiple headers with column span in Material-UI DataGrid? enter image description here

4

1 Answer 1

0

You can use a custom toolbar to achieve your goal. Here's the documentation on how to

Example


const CustomToolbar = (props) => <h1>I'm a custom toolbar</h1>;

export default function ToolbarGrid() {
  const { data } = useDemoData({
    dataSet: "Commodity",
    rowLength: 100,
    maxColumns: 6
  });

  return (
    <div style={{ height: 400, width: "100%" }}>
      <DataGrid
        {...data}
        components={{
          Toolbar: CustomToolbar
        }}
      />
    </div>
  );
}

Sign up to request clarification or add additional context in comments.

1 Comment

This just creates a toolbar, it doesn't add another header row to the table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.