mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

Mui datatable expanded view taking column width

Open MayankPoundrik opened this issue 5 years ago • 4 comments

Mui datatable in expanded view(nested table) is taking width of its parent row column.

Expected Behavior

On row expansion, expanded view should take full width of parent row.

Your Environment

Tech Version
Material-UI 4.3
MUI-datatables 2.14
React 16.8
browser Chrome
mui datable expanded view

MayankPoundrik avatar Apr 17 '20 20:04 MayankPoundrik

https://github.com/gregnb/mui-datatables/issues/1220

wdh2100 avatar Apr 22 '20 12:04 wdh2100

@MayankPoundrik Even I am facing same issue..was this fixed? how did u resolve this issue

PatilSneha avatar May 24 '21 10:05 PatilSneha

@gabrielliwerant can you please provide some insights into this?

Taimoor0217 avatar Aug 17 '21 09:08 Taimoor0217

For anyone looking to solve this.

Wrap you component in a <TableRow/> element and a <TableCell colSpan={whatever value}> here. You can pass child elements to the TableCell.

My use case was a table within a row:

    const options = {
        filter: true,
        pagination: false,
        filterType: 'dropdown',
        responsive: 'standard',
        expandableRows: true,
        selectableRows: 'none',
        expandableRowsHeader: false,
        expandableRowsOnClick: true,
        renderExpandableRow: (rowData, rowMeta) => {
            const colSpan = rowData.length + 1;

            return (
                <TableRow>
                    <TableCell colSpan={colSpan}>
                        <MUIDataTable
                            data={businessData.data[rowMeta.dataIndex].analyses}
                            columns={subTableColumns}
                            options={{
                                filter: false,
                                search: false,
                                print: false,
                                download: false,
                                viewColumns: false,
                                customToolbar: null,
                                responsive: 'vertical',
                                selectableRows: 'none',
                                enableNestedDataAccess: '.',
                                pagination: false,
                                selectToolbarPlacement: 'none',

                            }}
                        />
                    </TableCell>
                </TableRow>
            );
        },
    };

Zaggermeister avatar Mar 16 '24 05:03 Zaggermeister