我是网络开发的新手。我正在使用 react js。我这里有一张 table
这就像,
现在,我的代码是 ->
import React from 'react';
import { connect } from 'react-redux';
import { Table } from 'react-bootstrap';
import './Jobs.css';
class UserJobs extends React.Component {
constructor(props) {
super(props);
console.log("props are ==>", props.jdRecords);
this.state = {
jdRecords: props.jdRecords
}
}
render() {
const compName = {
fontSize: '14px'
};
return (
<div className="container-fluid">
<div className="row">
<Table striped condensed hover>
<thead>
<tr>
<th>Sr.No.</th>
<th>Company Name</th>
<th>Technology</th>
<th>Job Title</th>
<th>Total Score</th>
<th>Average Score</th>
</tr>
</thead>
<tbody>{this.props.jobData.map(function (item, key) {
return (
<tr key={key}>
<td><b style={compName}>{item.id}</b></td>
<td><b style={compName}>{item.attributes.companyName}</b></td>
<td>abc Developer</td>
<td>{item.attributes.name}</td>
<td>30</td>
<td>30</td>
</tr>
)
})}</tbody>
</Table>
<footer>
footer
</footer>
</div>
</div>
)
}
}
function mapStateToProps(state) {
return {
jobDescription: state.JobDescriptionData,
jobData: state.JobDescriptionData.jobData.data
}
}
export default connect(mapStateToProps, null)(UserJobs);
现在,这里,这个表有 10 多个条目。现在,我只想让那个表格的滚动条而不是整个页面的滚动条,而且它还有 页脚。
So, I tried :
height : 200px;
overflow-y : auto
但这行不通。
因为它也有一个导航栏。
谁能给我一些提示?
最佳答案
您需要为表格包装 div
并添加 max-height as 200, overflow :auto.
关于javascript - 向有页脚的表格添加滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51949514/