How to stretch row horizontally within a container using Boostrap 4? - html

The second div showing the table headers is not stretching as much as the one above and they are all in a container-fluid.
I've tried d-flex, flex-grow-1, but I believe it stretches it vertically.
I took <div class="col"> off and the table occupies the container width wise, but then the last colun (right side) "disappears":
<div class="row" id="tableDiv">
<div class="col">
<div id="po-items" class="table-responsive">
<div class="card" id="card">
<table class="table table-hover table-vcenter" id="dtable">
<thead>
<tr>
<th style="width:7%">Prenda</th>
<th style="width:10%;">Cliente</th>
<div class="container-fluid" id="container2">
<div class="row d-flex flex-wrap align-items-center align-items-stretch">
<div class="col padding-0">
<div id="supplierTable" class="table-responsive">
<table class="table table-borderless" id="supplier">
<thead style="white-space: nowrap">
<tr>
<th class="text-center">Proveedor</th>
</tr>
</thead>
<tbody>
<tr>
<td class="p-0">
<select id="selectSupplier" name="select" required="required" class="custom-select" onchange="loadAddress('supplier', this);generatePoNumber('new', selectedSupplier(), '', selectedOrderPo());loadBuyersFromSS('','');loadItems('','','supplier','new','Corte')">
<option value=""></option>
<option value="artico"></option>
<option value="misura"></option>
</select>
</td>
</tr>
<tr>
<td class="address"><br></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col padding-0">
<div id="buyerTable" class="table-responsive">
<table class="table table-borderless" id="buyer">
<thead style="white-space: nowrap">
<tr>
<th class="text-center">Comprador</th>
</tr>
</thead>
<tbody>
<tr>
<td class="p-0">
<select id="selectBuyer" name="select" required="required" class="custom-select" onchange="loadAddress('buyer', this)">
<option value=""></option>
</select>
</td>
</tr>
<tr>
<td class="address"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col padding-0">
<div id="billToTable" class="table-responsive">
<table class="table table-borderless" id="billTo">
<thead style="white-space: nowrap">
<tr>
<th class="text-center">Facturar</th>
</tr>
</thead>
<tbody>
<tr>
<td class="p-0">
<select id="selectBillTo" name="select" required="required" class="custom-select" onchange="loadAddress('billTo', this)">
<option value=""></option>
</select>
</td>
</tr>
<tr>
<td class="address"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row" id="tableDiv">
<div class="col">
<div id="po-items" class="table-responsive">
<div class="card" id="card">
<table class="table table-hover table-vcenter" id="dtable">
<thead>
<tr>
<th style="width:7%">Prenda</th>
<th style="width:10%;">Cliente</th>
<th style="width:14%">Referencia</th>
<th style="width:14%">Tela</th>
<th style="width:10%">Color</th>
<th style="width:4%">OS</th>
<th style="width:4%">XS</th>
<th style="width:4%">S</th>
<th style="width:4%">M</th>
<th style="width:4%">L</th>
<th style="width:4%">XL</th>
<th style="width:4%">2XL</th>
<th style="width:4%">3XL</th>
<th style="width:5%">Total</th>
<th style="width:5%">Precio sin IVA</th>
<th style="width:5%">Precio Total sin IVA</th>
<th style="width:3%">Sel.</th>
</tr>
</thead>
<tbody id="tableRows">

Have you tried placing the second div="col" within a div="row" ?

Related

How to change checkbox to required html format in pdfmake?

I want to change the below html to required format as in below image,
<div id="pdfTable" #pdfTable style="display: none;">
<table class="table table-borderless mb-0" style="font-size:14px;">
<thead>
<label for="" style="text-align: center;">Recommendation: </label>
<tr style="">
<td *ngFor="let recommendation of recommendations" style="border:0;width:25%">
<span *ngIf="recoName == recommendation.listTypeValueName">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYA alt="">
{{recommendation.listTypeValueName}}
</span>
<p *ngIf="recoName != recommendation.listTypeValueName"><img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAA alt="">
{{recommendation.listTypeValueName}} </p>
</td>
</tr>
</thead>
</table>
</div>
Required Format
What I am getting from above html
<div id="pdfTable" #pdfTable style="display: none;">
<table class="table table-borderless mb-0" style="font-size:14px;">
<thead>
<tr style="">
<th colspan="2" style="text-align: center;">Recommendation:</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let recommendation of recommendations">
<td style="width:25%;text-align:center;">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYA">
</td>
<td style="width:75%;text-align:left;">
{{recommendation.listTypeValueName}}
</td>
</tr>
</tbody>
</table>
</div>

bootstrap toggle-switch not working on table

i have a table with toggle switches, and i need them to be on or off according to the state i get on another column. Thing is i can't make it work, because the buttons are all disabled except the first one and the toggle is always off, no matter the state i'm getting.
Here's the stackblitz of what i'm currently trying: https://stackblitz.com/edit/angular-ivy-aje3j9?file=src/app/app.component.html
remove id="{{item}}" and bind the item for the id
<div class="row">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<table class="table table-striped table-bordered dt-responsive nowrap table-hover">
<thead>
<tr>
<th class="align-middle text-center">Agencia</th>
<th class="align-middle text-center">Flag</th>
<th class="align-middle text-center">Estado</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of flagEstadoAll; let item = index;" class="btn-off">
<td class="align-middle text-center">{{data.nombre_comercial}}</td>
<td class="align-middle text-center">{{data.nombre}}</td>
<td class="align-middle text-center">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" [id]="item">
<label class="custom-control-label" [for]="item">{{data.estado_flag == 'Activo' ? 'Desactivar' : 'Activar'}}</label>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
it should be work

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;">

I need to align tables with equal sizes (Bootstrap)

I need to make 2 Tables with vertical alignment.
so I made 2 div which one is "col-lg-10", another one is "col-lg-5"
I think it works with 1-Table and Half-Table exactly
but it doesn't work exactly, it's a little bit different.
[col-lg-10 / col-lg-5] , I think 10 is exactly half value of 5....
why doesn't it work?
<div class="table-responsive col-lg-10">
<table class="table table-bordered">
<tr>
<td class="col-lg-1">ABC</td>
<td class="col-lg-1">DEF</td>
<td class="col-lg-2" style="word-break:break-all">FGGFGGFGGFGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGG</td>
<td class="col-lg-1">342</td>
<td class="col-lg-1">ABc</td>
<td class="col-lg-1">DDF</td>
<td class="col-lg-1">AvV</td>
<td class="col-lg-1">DXZ</td>
<td class="col-lg-1">QQW</td>
</tr>
</table>
</div>
<div class="table-responsive col-lg-5">
<table class="table table-bordered">
<tr>
<td class="col-lg-2">ABC</td>
<td class="col-lg-3">DEF</td>
</tr>
</table>
</div>
Result ScreenShot
check the image this is regarding col*
here is the code after correction you can change the offset value as we want
<div class="row">
<div class="col-lg-10 col-md-10 col-md-10 offset-sm-1 col-sm-offset-2 col-md-offset-2">
<div class="table-responsive">
<table class="table table-bordered">
<tr class=row>
<td class="col-lg-1">ABC</td>
<td class="col-lg-1">DEF</td>
<td class="col-lg-2" style="word-break:break-all">FGGFGGFGGFGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGFGGG</td>
<td class="col-lg-1">342</td>
<td class="col-lg-1">ABc</td>
<td class="col-lg-1">DDF</td>
<td class="col-lg-1">AvV</td>
<td class="col-lg-1">DXZ</td>
<td class="col-lg-1">QQW</td>
<td class="col-lg-1">QQW</td>
<td class="col-lg-1">QQW</td>
</tr>
</table>
</div>
</div>
<div class="col-lg-5 offset-sm-4 ">
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<td class="col-lg-2">ABC</td>
<td class="col-lg-3">DEF</td>
</tr>
</table>
</div>
</div>
</div>

How can table content resposponsive in bootsrap

i am trying to set th width but it change only desktop view.
if i open that page in mobile table th not properly set.
i have also try col-xs-2 to fix th but it is not work
<div class="form-group col-lg-12 col-md-12 col-xs-12">
<div class="col-lg-12 col-md-12 col-xs-12 col-md-offset-1">
<div class="row" >
<div class = "table-responsive">
<table class="table table-hover table-striped">
<thead>
<tr class="info">
<th class="col-md-2 col-xs-2" > No</th>
<th class="col-md-4 col-xs-4">Dish Name</th>
<th class="col-md-2 col-xs-2"> Size</th>
<th class="col-md-2 col-xs-2">Prize</th>
<th class="col-md-2 col-xs-2">Order</th>
</tr>
</thead>
<tbody>
<tr title="Order Chicken Kadhai">
<td >1</td>
<td >Chicken Kadhai</td>
<td >Full</td>
<td >150/-</td>
<td ><input type="button" class="btn btn-info" value="ORDER"> </td>
</tr>
<tr>
<td >2</td>
<td >Chicken Roast</td>
<td >Full</td>
<td >250/-</td>
<td ><input type="button" class="btn btn-info" value="ORDER"> </td>
</tr>
<tr>
<td >3</td>
<td >Chicken Tandori</td>
<td >Full</td>
<td >350/-</td>
<td ><input type="button" class="btn btn-info" value="ORDER"> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
how can we set th to responsive table
From comments:
columns are not made for use in tables. .table-responsive adjusts
itself according to the content.
use this code might be help for you
<div class="table-responsive">
<table class="table">
...
</table>
</div>
write <class=".table-responsive>" instead of class=<class="table-responsive>"