I [unfortunately] have a table inside of a table. The last <td> of the outer table looks like so:
<td class="valign-top width-40 padding-right-4px">
<div class="grid-filter-container" style="overflow:auto;">
<table id="FilterColumns" class="fullwidth fimscaletable">
<thead>
<tr>
<th class="width-25 textalign-left k-header k-grid-header">
<span class="text-white">Field Name</span>
</th>
<th class="width-75 textalign-center k-header k-grid-header">
<span class="text-white">Condition</span>
</th>
</tr>
</thead>
<tbody></tbody>
<tbody></tbody>
</table>
</div>
</td>
The inner table programatically gets rows added to it, it's part of a data exporting module. The user is presented with a list of fields on the left, and then they can select it from the list and set some parameters and add it to this table on the right.
As you can see, the <div> containing the inner table has its overflow property set to auto. But during run time it only "gains" a horizontal scrollbar:
The table on the right started as the same size as the control on the left, but as I add more conditions to it, it grows in height. I want it to instead just scroll the div. Note this screenshot was taken in IE; haven't tested other browsers yet.
The grid-filter-container class is defined as so:
.k-window .grid-filter-container {
border: solid 1px #909090;
min-height: 200px;
padding: 0px;
margin: 0px;
}
js fiddle is actually blocked by my company's internet filters, otherwise I'd try to provide a sample.
Add height to the container
.k-window .grid-filter-container {
border: solid 1px #909090;
min-height: 200px;
padding: 0px;
margin: 0px;
height: 200px;
}
Related
I am using primeng picklist. I found that when the options length in the target or source control are bigger then the picklist control buttons in the middle gets smaller. My picklist code follows
<p-pickList [source]="availableFormula" [target]="selectedFormula" sourceHeader="Available Formula"
targetHeader="Selected Formula" [responsive]="true" filterBy="Name" dragdrop="true" dragdropScope="cars"
sourceFilterPlaceholder="Search by Formula" targetFilterPlaceholder="Search by Formula" [sourceStyle]="{'height':'300px'}"
[targetStyle]="{'height':'300px'}" showSourceControls="false" [showTargetControls]="false" (onSourceSelect)="formulaSelectEvent($event)"
(onTargetSelect)="formulaSelectEvent($event)">
<ng-template let-availableFormula pTemplate="item">
<div class="ui-helper-clearfix">
<div style="font-size:14px;float:right;margin:15px 5px 0 0">{{availableFormula.Name}}</div>
</div>
</ng-template>
</p-pickList>
I tried the following in CSS override to make it not shrink but nothing worked.
.ui-picklist-buttons{
width: 100% !important;
}
The problem is not with the width of the buttons.
The problem is that the picklist-buttons and picklist-listwrapper are declared as table-cell and td's increase their width depending on content. ( Unlike a block elements )
If you just want to have fixed column widths use table-layout: fixed on the ui-picklist. If the problem is that one list has a very long word inside it, use word-break: break-word on the picklist-listwrapper or on the ui-picklist-item
See example below
.fixed {
table-layout: fixed;
width: 100%;
}
.buttons {
width: 20%;
background: blue;
}
.list {
width: 40%;
background: red;
}
.not-fixed .list {
word-break: break-word;
}
<!–– with table-layout: fixed but no break-word -->
<table class="fixed">
<tr>
<td class="list">40percent</td>
<td class="buttons">button</td>
<td class="list">veryveryveasasasarylongtextthatdoesntfitin40percent</td>
</tr>
</table>
<!–– with break-word -->
<table class="not-fixed">
<tr>
<td class="list">40percent</td>
<td class="buttons">button</td>
<td class="list">veryveryveasasasarylongtextthatdoesntfitin40percent</td>
</tr>
</table>
I am using table (angular-4-data-table) which displays the rows. I wanted to have a vertical scrollbar with header fixed. I tried to add style= position: fixed; to the
<thead> section. I can see the fixed header, but when I scroll through, the table data section was moving on top of the header.
<table class="table table-condensed table-bordered data-table">
<thead style= position: fixed;>
</thead>
<tbody>
</tbody>
</table>
Is there any style that I can apply on tbody so that when scroll happens, it hides beneath the header.
tbody tag is relative so it will just operate as every other element in the page.
You should work only on the "special" element (thead) in order to let the browser works with the highest number of common element possible.
Have you tried giving z-index:999; as thead style?
Ok, now I remember how to do that.
Inside each <th> insert a <div> with the content of the column header, than using CSS you must set the div position absolute over the table and the th with 0 height.
Plus, you must give to a <div> containing the table a top-padding to leave the space for the fake <th>
It's not a nice code, but it works without JS.
<style>
.container { padding-top: 50px; }
.inner { height: 100px; overflow-y: auto; }
.t { width: 100%; table-layout: fixed; }
.t thead th { height: 0 !important; }
.t thead th > div {
position: absolute;
height: 50px;
line-height: 50px;
top: 0;
}
</style>
<div class="container">
<div class="inner">
<table class="t">
<thead><tr>
<th><div>col 1</div></th>
<th><div>col 2</div></th>
</tr></thead>
<tbody>
<tr>
<td>a</td>
<td>b</td>
</tr>
</tbody>
</table>
</div>
</div>
I have a regular table with table rows that are generated with ngFor loop.. the issue is the following: Even though I have set css of table-wrapper to max-height: 450px and overflow-y: auto; , it doesnt matter, that div gets the scroll needed, but my entire page, entire body element, has the height of that table with every single row... Anyone had similar issue?
.table-wrapper {
display: block;
max-height: 450px;
overflow-y: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
td {
border: 1px solid black;
}
<div class="table-wrapper">
<!-- I'm reproducing the DOM after Angular ng for -->
<table>
<tr *ngFor="let s of something">
<td>Some content</td>
</tr>
</table>
</div>
I have some markup like so:
<table>
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<tr>
</thead>
<tbody>
<tr class="main">
<td>some content</td>
<td>some content2</td>
<tr>
<tr class="more">
<td colspan="2">
<div class="more-link"><a tabindex="0" href="#">Show more info</a></div>
<div class="more-info">
more info goes here
</div>
</td>
<tr>
</tbody>
</table>
And some CSS:
td, th{
border: 1px solid red;
}
.main td{
height: 50px;
width: 300px;
vertical-align: top;
}
.main td{
border-bottom: 0;
}
.more td{
border-top: 0;
height: 0;
}
.more-link{
position: relative;
top: -30px;
}
.more-link:focus + div, .more-link:active + div{
height: auto;
}
What I want to do is that when the "show more info" link is clicked, the table row called "more" expands.
The problems:
There is no effect if I set the td inside more to have a height of 0;
If I set height of the more-info div to 0, or display:none, the table row still takes up space.
I would like to do this with just CSS, javascript can be used to make it better, but the basics should just work without javascript.
How can I get my more row to expand when the show more info link is clicked?
And a fiddle: http://jsfiddle.net/QJr2e/
Got it!
Instead of using position:relative to move the "show more info" link, I gave it a float:left. This allowed me to move it anywhere I want using margin, while reorganizing the flow.
Instead of using height, I just set more-info to display:none, and then when the "show more info" link is clicked:
.more-link:active + div, .more-link:focus + div{
display: block;
}
I have a DOM structure like the following:
<table class="playlist">
<thead>
<tr>
<th>TH1</th>
<th width="53">TH2</th>
<th width="53">TH3</th>
<th width="53">TH4</th>
<th width="53">TH5</th>
<th width="53">TH6</th>
</tr>
</thead>
<tbody>
<tr>
<td>TD1</td>
<td>TD2</td>
<td>TD3</td>
<td>TD4</td>
<td>TD5</td>
<td>TD6</td>
</tr>
<tr class="expansion">
<td class="expansion" colspan="6">
<div class="comment_wrapper">
<form>
<textarea style="width=482px" class="mini">x</textarea>
</form>
</div>
</td>
</tr>
</tbody>
</table>
Related style rules are like:
table {
width: 580px;
border-bottom: 1px solid #EEE;
}
.comment_wrapper {
height: 270px;
border: 1px red solid;
overflow-x: hidden;
overflow-y: auto;
}
.comment_wrapper form textarea {
height: 70px;
width: 482px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border: 1px red solid;
}
My problem is that whenever I added the second tr, width of table columns changed into a mess like the following in IE6/7.
When I comment out this tr, the column width restore.
Why does adding a tr affects column width? How can I avoid this effect?
PS
I've reproduced this problem on JSFiddle, and this is the link: http://jsfiddle.net/7mYY8/1/
Well, you have 6 columns 5 of which have a defined width.
The 1st column doesn't. This means it has to be computed. Sure you have the table width defined in CSS, but IE 6 isn't exactly the best thing.
Your best bet is going to be to explicitly define the width of all of your header columns. Then give the table the css attribute of "table-layout: fixed". This is going to enforce your widths for the entire rendering of the table.