1

im starting a new project using react, react-router and material-ui-next.

Im facing a problem that i've trying to find with no success.

table exceeds containing component boundaries

Structure is in this way

return (
            <Paper>
                <Fragment>
                    <CommonToolbar reload={getAnns} />
                    <Typography variant="title">Announces</Typography>
                    <Table className={classes.table}>
                        <TableHead>

styles is defined this way

const styles = {
    root: {
        flexGrow: 1,
        padding: 10,
        margin: 10
    },
    flex: {
        flex: 1,
    },
    input: {
        marginRight: 10
    },
    select: {
        marginRight: 10
    }
}

What im trying to achieve is a table contained on the screen, and if it exceeds the screen, the table should be horizontally scrollable, but always contained inside the Paper Component.

Any hint will be appreciated. Thanks

Regards

1 Answer 1

2

Can you try adding overflowX: "auto" in your paper container?

JSX:

return (
            <Paper className={classes.paperContainer}>
                <Fragment>
                    <CommonToolbar reload={getAnns} />
                    <Typography variant="title">Announces</Typography>
                    <Table className={classes.table}>
                        <TableHead>

Your styles:

const styles = {
    root: {
        flexGrow: 1,
        padding: 10,
        margin: 10
    },
    flex: {
        flex: 1,
    },
    input: {
        marginRight: 10
    },
    select: {
        marginRight: 10
    },
    paperContainer: { margin: "10px", overflowX: "auto" }
}
Sign up to request clarification or add additional context in comments.

Comments

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.