【问题标题】:Add a scrollbar to the table which is having a footer向有页脚的表格添加滚动条
【发布时间】:2018-08-21 13:12:23
【问题描述】:

我是网络开发的新手。我正在使用反应 js 。这里有一张桌子

就像,

现在,我的代码是 ->

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

但这不起作用。

因为它也有一个导航栏。

谁能给我一些提示?

【问题讨论】:

    标签: javascript css html twitter-bootstrap-3


    【解决方案1】:

    您需要一个包装器 div 用于表并添加 max-height as 200, overflow :auto.

    【讨论】:

    猜你喜欢
    • 2013-07-01
    • 1970-01-01
    • 2011-07-28
    • 2015-04-05
    • 1970-01-01
    • 2019-02-20
    • 1970-01-01
    • 1970-01-01
    • 2021-11-29
    相关资源
    最近更新 更多