Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 垂直滚动物料界面表体_Reactjs_Html Table_Material Ui - Fatal编程技术网

Reactjs 垂直滚动物料界面表体

Reactjs 垂直滚动物料界面表体,reactjs,html-table,material-ui,Reactjs,Html Table,Material Ui,我正在为我的React.js应用程序使用Material UI表。如果表太长,我想垂直滚动它的主体。这是桌子 <Table style={TableBorder}> <colgroup> <col style={{width: '10%'}}/> <col style={{

我正在为我的React.js应用程序使用Material UI表。如果表太长,我想垂直滚动它的主体。这是桌子

<Table style={TableBorder}>
                            <colgroup>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '30%'}}/>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '10%'}}/>
                                <col style={{width: '10%'}}/>
                            </colgroup>
                            <TableHead>
                                <TableRow>
                                    <TableCell align="center"
                                               style={styles.table.tableHead.tableCell}>PRODUCT</TableCell>
                                    <TableCell align="center"
                                               style={styles.table.tableHead.tableCell}>BUILDS</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>INSTRUCTIONS(%)</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>BRANCHES(%)</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>COMPLEXITY(%)</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>LINES(%)</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>METHODS(%)</TableCell>
                                    <TableCell align="right"
                                               style={styles.table.tableHead.tableCell}>CLASSES(%)</TableCell>
                                </TableRow>
                            </TableHead>
                            <TableBody>
                                {this.state.tableSummary.map((row, index) => (
                                    <TableRow key={index}
                                              style={((row[1] > 0) ? styles.table.tableBody.tableCell.cursorPointer : styles.table.tableBody.tableCell.cursorText)}
                                              hover>
                                        <TableCell component="th" scope="row"
                                                   align="left">{row.name}</TableCell>
                                        <TableCell style={builds}
                                                   align="left">{formatBuildString(row.build_no)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalIns, row.data.missIns)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalBranches, row.data.missBranches)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalCxty, row.data.missCxty)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalLines, row.data.missLines)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalMethods, row.data.missMethods)}</TableCell>
                                        <TableCell
                                            align="right">{getPercentage(row.data.totalClasses, row.data.missClasses)}</TableCell>
                                    </TableRow>
                                ))}
                            </TableBody>
                        </Table>

但当我使用它时,我的桌子并没有很好地对齐。

你们应该以这种方式赋予桌子风格

&lt;Table className="scroll">
....
&lt;/Table>


*.css file

.scroll {

   height: 100px;     
   overflow-y: auto;    
   overflow-x: hidden;

}

or if you customize table with styled component you can do in this way.

const ScrollYTable = styled(Table)&#768;

   height: 100px;     
   overflow-y: auto;    
   overflow-x: hidden;

&#768;
&lt;Table className="scroll">
....
&lt;/Table>


*.css file

.scroll {

   height: 100px;     
   overflow-y: auto;    
   overflow-x: hidden;

}

or if you customize table with styled component you can do in this way.

const ScrollYTable = styled(Table)&#768;

   height: 100px;     
   overflow-y: auto;    
   overflow-x: hidden;

&#768;