Bootstrap nesting, shows on page but not on print - html

I cant seem to get this right, i made a divider through css divs and it shows on page but when in print the lines i made doesnt show..what other options should i do? im running out of ideas, what am i doing wrong how can i achieve this
here is what i want ot achieve
heres my css
heres the print preview
page code:
<div id="page-wrapper">
<div class="row">
<div class="col-md-12">
<div class="panel-body">
<p style="text-align:center;"><b>PROPERTY ACKNOWLEDGEMENT RECEIPT</b></p>
<p style="text-align:right;">Control No.</p>
<div class="row">
<div class="col-md-16">
<table class="table table-hover table-striped table-bordered table-condensed" class="">
<thead>
<tr>
<th style="text-align:center;">Quantity</th>
<th style="text-align:center;">Unit</th>
<th style="text-align:center;">Description</th>
<th style="text-align:center;">Unit Value</th>
<th style="text-align:center;">Property No.</th>
</tr>
</thead>
<tbody>
<tr>
<td>12</td>
<td>bucket</td>
<td style="font-size:12px;">oremloremloremloremloremloremloremloremloremlorem</td>
<td>2</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<hr style="background-color:black;"> NOTE:
<div style="height:2px;width:100%;background-color:black;"></div>
<div style="width:2px;height:100px;background-color:black;margin:0px auto;"></div>
</div>
</div>
</div>
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true
});
});

Related

HTML table header sticky to 3rd parent

I need to make table header sticky to div fot, but still having the table x-scrollable, if it gets wider than the screen. I tried a lot of CSS combinations, but no success.
<body>
<div id="fot">
<form id="frmSearch_1" method="post">
<div id="tableDiv" style="overflow-x:auto;">
<table id="printGT" style="overflow-x:auto;width:100%;">
<thead>
<tr id="printGT_head">
<th scope="col">Nr.</th>
<th scope="col">Nr.</th>
<th scope="col">Nr.</th>
<th scope="col">Nr.</th>
</tr>
</thead>
<tbody>
<tr class="table-row">
<td>Nr</td>
<td>112</td>
<td>202a</td>
<td>asd</td>
</tr>
</tbody>
</table>
</div>
</form>
<span>LOT OF OTHER LONG CONTENT</span>
</div>
</body>

Tables in Bootstrap 4 with real width of columns

I am trying to make something like this in Bootstrap 4, setting the columns of table in pixels, with fixed values, forcing the horizontal scroll inside the card, but is not working. The columns don't have the size I want. The columns sizes are going to be same for all devices.
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table class="table-sm table-hover table-bordered text-center">
<thead>
<tr class="text-uppercase font-size-1">
<th width="500px" class="font-weight-medium"></th>
<th width="500px" class="font-weight-medium">produto</th>
<th width="500px" class="font-weight-medium">status</th>
<th width="500px" class="font-weight-medium">sku</th>
<th width="500px" class="font-weight-medium">preço</th>
<th width="500px" class="font-weight-medium">estoque</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
What am I doing wrong?
It does seem to be working here is the example code
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table class="table-sm table-hover table-bordered text-center">
<thead>
<tr class="text-uppercase font-size-1">
<th style="width:100px" class="font-weight-medium">first</th>
<th style="width:200px" class="font-weight-medium">produto</th>
<th style="width:300px" class="font-weight-medium">status</th>
<th style="width:400px" class="font-weight-medium">sku</th>
<th style="width:500px" class="font-weight-medium">preço</th>
<th style="width:600px" class="font-weight-medium">estoque</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
you need to put correct inline styles tag
<th style="width:500px;">

Bootstrap 4 .table-responsive class won't take 100% width

I got 2 tables with same HTML and both declared as:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-12 col-md-6">
<div class="card">
<div class="card-body">
<table class="table table-sm table-hover table-responsive">
<thead>
<tr>
<th>Item 01</th>
<th>Item 02</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item 01</td>
<td>Item 02</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
And this is what I got on my screen:
The second and consecutive tables declared with the same HTML don't get 100% width on thead and tbody...
What is wrong here?
UPDATE:
My first table was working because of the content of the last line, it was long enough to make it fit 100% on my card div.
Actually it's a issue on Bootstrap 4, so the -2 reputation on this question are invalid. Thanks.
Found out that it's a issue on Bootstrap V4, you can see in this issue, and my first table is not working, it's just the content of the last line that is long enough to fullfil the table width, so it looks like it works.
EDIT: It got fixed by adding the class table-responsive as a parent div of the table, here is the ship list for the fix and the issue that reported the bug.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-12 col-md-6">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr>
<th>Item 01</th>
<th>Item 02</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item 01</td>
<td>Item 02</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

Adding bootstrap btn-group to panel-heading adds space below panel-heading

I'm trying to get a button into a panel-heading section, but I can't get it to display on the same line. I've managed to get it centered with help of some of the questions on StackOverflow where others asked about a button on the right of the header, but adding the button in seems to make the header taller.
I've got an example showing the difference Bootply
Code
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel panel-default" ng-init="getApplications()">
<div class="panel-heading clearfix">
<b>Title has space below</b>
<div class="btn-group pull-right">
new
</div>
</div>
<div class="panel-body">
<!-- table -->
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>Last Release Date</th>
<th>Orders</th>
<th>Downloads</th>
<th>Activations</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="app in apps">
<td>{{app.columns.name}}</td>
<td>{{app.lastReleaseDt}} </td>
<td>{{app.totalOrders}}</td>
<td>TODO </td>
<td>{{app.totalActivations}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default" ng-init="getApplications()">
<div class="panel-heading clearfix">
<b>Title has no space</b>
</div>
<div class="panel-body">
<!-- table -->
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>Last Release Date</th>
<th>Orders</th>
<th>Downloads</th>
<th>Activations</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="app in apps">
<td>{{app.columns.name}}</td>
<td>{{app.lastReleaseDt}} </td>
<td>{{app.totalOrders}}</td>
<td>TODO </td>
<td>{{app.totalActivations}}</td>
</tr>
</tbody>
</table>
</div>
</div>
Does anybody have any ideas why adding a button or button group to the panel heading increases the height? Any tips on getting the height to what it was before the button?
because you are using a btn-sm (for small-devices) if you use btn-xs (for extra-small devices) that space will go away due to having a smaller padding
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel panel-default" ng-init="getApplications()">
<div class="panel-heading clearfix">
<b>Title has space below</b>
<div class="btn-group pull-right">
new
</div>
</div>
<div class="panel-body">
<!-- table -->
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>Last Release Date</th>
<th>Orders</th>
<th>Downloads</th>
<th>Activations</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="app in apps">
<td>{{app.columns.name}}</td>
<td>{{app.lastReleaseDt}} </td>
<td>{{app.totalOrders}}</td>
<td>TODO </td>
<td>{{app.totalActivations}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default" ng-init="getApplications()">
<div class="panel-heading clearfix">
<b>Title has no space</b>
</div>
<div class="panel-body">
<!-- table -->
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>Last Release Date</th>
<th>Orders</th>
<th>Downloads</th>
<th>Activations</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="app in apps">
<td>{{app.columns.name}}</td>
<td>{{app.lastReleaseDt}} </td>
<td>{{app.totalOrders}}</td>
<td>TODO </td>
<td>{{app.totalActivations}}</td>
</tr>
</tbody>
</table>
</div>
</div>

How to align two tables in the same row inside a Bootstrap Panel?

I want to put side-by-side two tables in the same grid-row but tables just stack over when run the code below:
<body>
...
<div class="container-fluid">
<div class="starter-template">
<div class='panel panel-primary'>
<div class='panel-heading'><h1>Main Title</h1></div>
<div class='panel-body'>
<div class='row-fluid'>
<h4>Title</h4>
<div class='span4'>
<table class='table table-bordered'>
<thead>
<tr><th>feat1</th><th>feat2</th></tr></thead>
<tbody>
<tr><td>132</td><td>value a</td></tr>
<tr><td>114</td><td>value b</td></tr>
</tbody>
</table>
</div><!--closes table1-->
<div class='span4'>
<table class='table table-bordered'>
<thead>
<tr><th>feat1</th><th>feat3</th></tr>
</thead>
<tbody>
<tr><td>264</td><td>val b</td></tr>
<tr><td>3</td><td>val c</td></tr>
</tbody>
</table>
</div><!--closes table2-->
</div>
</div><!--closes div panel-body-->
</div><!--closes div panel-->
</div> <!-- /.starter-template -->
</div><!-- /.container -->
...
</body>
The result is one table in all the row and then the second one below the first one.
Check out the fiddle
Use col-xs-6 if you still want to display the tables side by side when on smaller screens.
Use col-lg-6 if you want to display the tables on separate rows on smaller screens.
http://jsfiddle.net/DTcHh/1680/
<div class="row-fluid">
<div class="col-xs-6">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>One</th>
<th>One</th>
<th>One</th>
</tr>
<thead>
<tbody>
<tr>
<td>Two</td>
<td>Two</td>
<td>Two</td>
</tbody>
</table>
</div>
</div>
<div class="col-xs-6">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>One</th>
<th>One</th>
<th>One</th>
</tr>
<thead>
<tbody>
<tr>
<td>Two</td>
<td>Two</td>
<td>Two</td>
</table>
</div>
</div>
</div>