I have a table in a bootstrap-5 web page:
<table class="table align-middle table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
<th scope="col">TITLE 1</th>
<th scope="col">TITLE 2</th>
<th scope="col">TITLE 3</th>
<th scope="col">TITLE 4</th>
<th scope="col">TITLE 5</th>
<th scope="col">TITLE 6</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>Bird</td>
<td>#twitter</td>
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
<td>foo</td>
<td>boo</td>
<td>goo</td>
<td>poo</td>
<td>zoo</td>
</tr>
</tbody>
</table>
In small screens it looks good:
But in a wider screen there is a strange wide column for the text box:
How to fix it, and make the text box column to be same width as the other columns?
Fairly self explanatory, you have a div around that input field that is setting a column size:
<td><div class="col-12 col-md-3"><input type="text" class="form-control form-control-sm" placeholder="sum"></div></td>
Simply remove it and the column will scale with the rest of the table:
<td><input type="text" class="form-control form-control-sm" placeholder="sum"></td>
EDIT:
Something like this would set a fixed width for all table columns:
td {
width: 10%;
}
Related
Anyone know how to use datatable with format table like this
table
My data table can't use with format table like that. My code for show data
<table id="table-rekap" class="table table-bordered">
<thead>
<tr>
<th class="text-center" style="width: 20%;">No</th>
<th class="text-center" style="width: 20%;">Unit Kerja</th>
<th>Jenis Kendaraan</th>
<th>Total</th>
</tr>
</thead>
#php $no = 1; #endphp
<tbody>
#foreach($rekapUnker as $unitKerja => $jenisKendaraan)
<tr>
<td class="text-center" rowspan="9">{{ $no++ }}</td>
<td class="text-center" rowspan="9">{{ $unitKerja }}</td>
#foreach($jenisKendaraan as $jenKen => $total)
<tr>
<td>{{ $jenKen }}</td>
<td>{{ $total }}</td>
</tr>
#endforeach
</tr>
#endforeach
</tbody>
</table>
Id table rekap for call data table
I am trying to print a html using dompdf and I am trying to add a footer but the footer only shows only the last page in print view? Is it a chrome bug?
<table class="table table-bordered" cellspacing="0" style="color:black">
<thead>
<tr>
<th scope="col" style="border-top: color: white; border-left: color: white;border-right: color: white;" colspan="4"> </th>
</tr>
<tr class="text-center">
<th scope="col" class="align-middle" ></th>
<th scope="col" class="align-middle text-nowrap">Reference No.: BatStateU-FO-ESO-01</th>
<th scope="col" class="align-middle text-nowrap">Effectivity Date: January 3, 2017</th>
<th scope="col" class="align-middle text-nowrap">Revision No.: 00</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);"> Extension Service / Training is requested by clients.</p> <br>
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);" checked> Extension Service / Training is Department’s initiative.</p>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="col" colspan="4"> </th>
</tr>
</tfoot>
</table>
I'm trying to get this razor template working but am having trouble declaring the variables for FDate1,2,3,4,5,etc... correctly.
For example I've just included the first FDate1 at the top. The lower part of my code is working correctly the looping part.
What am i doing incorrectly?
#{
string FDate1 = var row in AME.GridF18.FDate1("SubmissionID='" + TknParams.SubmissionID + "'");
}
<div class="table-responsive">
<table class="table table-striped table-condensed table-bordered" width="100%" border="0">
<tbody>
<tr>
<th colspan="7" scope="col">#FDate1</th>
<th colspan="2" scope="col">#FDate2</th>
<th colspan="2" scope="col">#FDate3</th>
<th colspan="2" scope="col">#FDate4</th>
<th colspan="2" scope="col">#FDate5</th>
<th colspan="2" scope="col">#FDate6</th>
<th colspan="1" scope="col">#FDate7</th>
<th colspan="1" scope="col">#FDate8</th>
}
</tr>
<tr>
<th rowspan="2" scope="col">Project #</th>
<th rowspan="2" scope="col">PW</th>
<th rowspan="2" scope="col">Project Name</th>
<th rowspan="2" scope="col">Type of Work</th>
<th rowspan="2" scope="col">Mile</th>
<th rowspan="2" scope="col">Toll</th>
<th rowspan="2" scope="col">Park</th>
<th colspan="2" scope="col">Monday</th>
<th colspan="2" scope="col">Tuesday</th>
<th colspan="2" scope="col">Wednesday</th>
<th colspan="2" scope="col">Thursday</th>
<th colspan="2" scope="col">Friday</th>
<th scope="col">Saturday</th>
<th scope="col">Sunday</th>
<th scope="col">Total</th>
</tr>
<tr>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
#foreach (var row in AME.GridF18("SubmissionID='" + TknParams.SubmissionID + "'")) {
<tr>
<td>#row.ProjectNumber</td>
<td><input id="checkBox" type="checkbox"></td>
<td>#row.ProjectName</td>
<td>#row.TypeofWork</td>
<td>#row.Mile</td>
<td>#row.Toll</td>
<td>#row.Park</td>
<td>#row.MonRT</td>
<td>#row.MonOT</td>
<td>#row.TuesRT</td>
<td>#row.TuesOT</td>
<td>#row.WedsRT</td>
<td>#row.WedsOT</td>
<td>#row.ThursRT</td>
<td>#row.ThursOT</td>
<td>#row.FriRT</td>
<td>#row.FriOT</td>
<td>#row.Saturday</td>
<td>#row.Sunday</td>
<td>#row.Total</td>
</tr>
}
</tbody>
</table>
</div>
In my ASP.NET MVC Core app that uses Bootstrap (installed by default by Visual Studio 2015 MVC Core project), I need to use ID column in a controller but want to hide it in the View. But the following View still displays the column as blank. I would like to hide the first columns that is the ID column
View:
#model List<myProj.Models.StateName>
<form id="target" asp-controller="TestController" asp-action="TestAction" asp-route-returnurl="#ViewData[" ReturnUrl"]" method="post">
<table class="table">
<thead>
<tr>
<th></th>
<th>
State Name
</th>
<th>
State Code
</th>
</tr>
</thead>
<tbody>
#for (int i = 0; i < Model.Count(); i++)
{
<tr>
<td><input asp-for="#Model[i].StateId" type="hidden" /></td>
<td>
<label asp-for="#Model[i].State"></label>
</td>
<td>
<input asp-for="#Model[i].StateCode" type="text" readonly style="border:0px;"/>
</td>
</tr>
}
</tbody>
</table>
<button type="submit" class="btn btn-default">Save</button>
</form>
I've tested the behavior you describe in this pen. The "Bad Table" version demonstrates what I believe you are likely seeing and occurs by neglecting to add display:none to one single th/td in that column. The "Good Table" version has the first column completely hidden and stretches to fill the entire available width.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<h2>Good Table</h2>
<table class="table">
<thead>
<tr>
<th style="display:none">Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display:none">Data 1.1</td>
<td>Data 1.2</td>
<td>Data 1.3</td>
</tr>
<tr>
<td style="display:none">Data 2.1</td>
<td>Data 2.2</td>
<td>Data 2.3</td>
</tr>
<tr>
<td style="display:none">Data 3.1</td>
<td>Data 3.2</td>
<td>Data 3.3</td>
</tr>
</tbody>
</table>
<h2>Bad Table</h2>
<table class="table">
<thead>
<tr>
<th style="display:none">Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display:none">Data 1.1</td>
<td>Data 1.2</td>
<td>Data 1.3</td>
</tr>
<tr>
<td>Data 2.1</td> <!-- WHOOPS -->
<td>Data 2.2</td>
<td>Data 2.3</td>
</tr>
<tr>
<td style="display:none">Data 3.1</td>
<td>Data 3.2</td>
<td>Data 3.3</td>
</tr>
</tbody>
</table>
Long and short, check the rendered output and ensure that each th/td in the column you are hiding ended up with the display:none style.
This is what my highchart looks like atm
I kinda want the chart to be on the right side while the table to be on the left
this is my html:
<div id="words" style="width:70%;float:left;">
<table border="1" class="highchart" data-graph-container-before="1" data-graph-type="column">
<thead>
<tr>
<th>Word</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<tr>
<td>icon</td>
<td>12</td>
</tr>
<tr>
<td>text</td>
<td>12</td>
</tr>
<tr>
<td>your</td>
<td>9</td>
</tr>
<tr>
<td>post</td>
<td>6</td>
</tr>
<tr>
<td>document</td>
<td>5</td>
</tr>
<tr>
<td>with</td>
<td>5</td>
</tr>
<tr>
<td>parentNode</td>
<td>4</td>
</tr>
<tr>
<td>email</td>
<td>4</td>
</tr>
<tr>
<td>com"</td>
<td>4</td>
</tr>
<tr>
<td>googletag</td>
<td>3</td>
</tr>
</tbody>
</table>
What should i do to achieve such output?
If you can change HTML, then simply put table before Highcharts container and set proper styles (float, width). For example you can also use two divs: http://jsfiddle.net/68qdew8g/
<div style="float: left; width: 30%;">
<table border="1" class="highchart" data-graph-container-before="1" data-graph-type="column">
...
</table>
</div>
<div id="words" style="width:70%;float:left;"></div>