Dmitry Fadeev
Dmitry Fadeev

Reputation: 1

MUI datagrid does not expand all the way when it has checkboxes

I'm using DataGridPremium with checkboxes enabled. The datagrid does not expand all the way to the edges of the encapsulating <Card> (see screenshot #1) if I remove checkboxSelection from DataGridPremium it does expand to the edges of the card (see screenshot #2). Has anyone tried to solve this issue?

Screenshot #1 Screenshot #2

Here is an example:

import { DataGridPremium } from '@mui/x-data-grid-premium';
import { useDemoData } from '@mui/x-data-grid-generator';

export default function DataGridPremiumDemo() {
const { data, loading } = useDemoData({
    dataSet: 'Commodity',
    rowLength: 100,
    editable: true,
    visibleFields,
  });

<DataGridPremium
    {...data}
    checkboxSelection
    disableRowSelectionOnClick
/>
}

(Please note that you need DataGridPremium licence to be able to run this example.)

I tried adding a checkbox column settings by adding GRID_CHECKBOX_SELECTION_COL_DEF in the column settings and it doesn't change a thing (except repositioning the checkbox column if I specify it as last column for ex.).

Upvotes: 0

Views: 18

Answers (0)

Related Questions