Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  24] [ 7]  / answers: 1 / hits: 67371  / 5 Years ago, mon, january 21, 2019, 12:00:00

enterenter
I am new to front-end-development. Here I have the following table:


  <div className="table-responsive">
<table className="table table-hover" id="job-table">
<thead>
<tr className="text-center">
<th scope="col">Sr.No.</th>
<th scope="col">Company Name</th>
<th scope="col">Technology</th>
<th scope="col">Total Resumes</th>
<th scope="col">Job Title</th>
<th scope="col">Total Score</th>
<th scope="col">Average Score</th>
</tr>
</thead>
<tbody className="text-center">
{this.props.list && this.props.list.content && this.props.list.content.length > 0 && this.props.list.content.map((item, key) => {
return (
<tr key={key}>
<td className="font-weight-bold">1</td>
<td className="font-weight-bold">ABCDED</td>
<td>Software Developer</td>
<td className="font-weight-bold">17</td>
<td>5 years experience</td>
<td className="font-weight-bold">30</td>
<td className="font-weight-bold">30</td>
</tr>
)
})}
</tbody>
</table>
</div>

In this I have used the table-responsive class. I have tried to make this table scrollable by using this:


tbody { height: 400px; overflow-y: scroll }

But this is not working.


One other thing about the content of the td, if it is large the other rows gets affected. How can I avoid this scenario?


enter
[![enter image description here][3]][3]


More From » html

 Answers
7

Try using flex, it should be compatible with table-responsive:



table {
display: flex;
flex-flow: column;
width: 100%;
}

thead {
flex: 0 0 auto;
}

tbody {
flex: 1 1 auto;
display: block;
overflow-y: auto;
overflow-x: hidden;
}

tr {
width: 100%;
display: table;
table-layout: fixed;
}


Hope this will help


[#52744] Monday, January 14, 2019, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
havenbilliec

Total Points: 324
Total Questions: 106
Total Answers: 94

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;