tbody in table is not as per thead in table - css

My tbody of table is not as per thead of table.
table {
width: 100%;
}
tbody {
display: block;
max-height: 160px;
overflow-y: scroll;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<table id="myHeader" class="scroll table table-striped table-hover table-bordered table-responsive">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th class="mobiile">Document</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>
[userName]
</td>
<td>
[userProfession]
</td>
<td class="mobiile"><iframe id="myHeader" src="https://i.stack.imgur.com/Pnq8a.jpg" width="250px" height="250px"></iframe></td>
<td>
<div class="dropdown">
<button class="dropbtn">Action</button>
<div class="dropdown-content">
<a class="btn btn-primary" href="user_images/['userPic']"><span class="glyphicon glyphicon-eye-open"></span> View</a>
<p id="i['userID']" style="display: none;">
['userPic']
</p>
<button onclick="copyToClipboard('#i['userID']')" class="btn btn-primary"><span class="glyphicon glyphicon-eye-open"></span> Share</button>
<script>
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
$("<div class='alert alert-success'>Copied url of image: <font color='blue'>[userName]</font>! </div>").insertBefore('#cr').delay(3000).fadeOut();
}
</script>
<a class="btn btn-success" href="user_images/['userPic']" title="Download [userName]" download><span class="glyphicon glyphicon-download"></span> Download</a>
<a class="btn btn-info" href="editform.php?edit_id=['userID']" title="click for edit"><span class="glyphicon glyphicon-edit"></span> Edit</a>
<a class="btn btn-danger" href="?delete_id=['userID']" title="click for delete" onclick="return confirm('sure to delete ?')"><span class="glyphicon glyphicon-remove-circle"></span> Delete</a>
</div>
</div>
</td>
</tr>
</tbody>
</table>

Related

Columns in Table not aligned properly

I have this html styled with bootstrap. My problem is that the row inside thead is not aligned with the row inside tbody (see the jsfiddle link to see an example of what's happening):
<table class="table">
<thead>
<tr id="table-header">
<th scope="col">#</th>
<th class="search" scope="col">nome</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody id="table-body" style="display: block;" data-json="/categoria/list.json">
<tr>
<th scope="row">1</th>
<td>hum</td>
<td>
<div class="btn-group" id="buttons" role="group" aria-label="comandos">
<button sec:authorize="hasPermission(#user, 'atualiza_categoria')" type="button" class="btn btn-secondary" id="update" th:attr="data-url=#{/categoria/update}" onclick="open_tab(this)">
edit
</button>
<button sec:authorize="hasPermission(#user, 'remove_categoria')" type="button" class="btn btn-secondary" id="delete" th:attr="data-url=#{/categoria/delete}" onclick="open_tab(this)">
del
</button>
</div>
</td>
</tr>
</tbody>
<tbody id="table-search" style="display: none;" data-json="/categoria/search.json"></tbody>
</table>
this code is based on the first example available here: https://getbootstrap.com/docs/4.4/content/tables/. I tried change the line:
<th scope="row">1</th>
inside tbody to:
<td scope="row">1</td>
but the same issue occurs.
jsfiddle: https://jsfiddle.net/klebermo/0gdtf7qy/
Anyone can tell how to fix that?
You can't use tbody display: block;. tbody display property will be table-row-group.
So removed style="display: block;" from tbody tag. Check here working example
Remove display: block; css property from tbody tag
<table class="table">
<thead>
<tr id="table-header">
<th scope="col">#</th>
<th class="search" scope="col">nome</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody id="table-body" data-json="/categoria/list.json">
<tr>
<th scope="row">1</th>
<td>hum</td>
<td>
<div class="btn-group" id="buttons" role="group" aria-label="comandos">
<button sec:authorize="hasPermission(#user, 'atualiza_categoria')" type="button" class="btn btn-secondary" id="update" th:attr="data-url=#{/categoria/update}" onclick="open_tab(this)">
edit
</button>
<button sec:authorize="hasPermission(#user, 'remove_categoria')" type="button" class="btn btn-secondary" id="delete" th:attr="data-url=#{/categoria/delete}" onclick="open_tab(this)">
del
</button>
</div>
</td>
</tr>
</tbody>
<tbody id="table-search" style="display: none;" data-json="/categoria/search.json"></tbody>
</table>

Replace the child node in c#

I have a string HTML code like
<table id='topInfoBar' style=" width: 100%;" cellspacing='0' border='0'>
<Tr>
<td id='lockOrder' clientidmode='static' style="text-align:Right;color:black;font-weight:bold">
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' />
</td>
</Tr>
</table>
I want to check if id 'lockOrder' exists in the string and if yes, want to replace img node i.e
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' />
with
<i class="fa fa-search fa-2x cursorpointer" title="This order is locked"></i>
want to do it in c#.
Use property Visible and change it in if
HTML
<table id='topInfoBar' style="width: 100%;" cellspacing='0' border='0'>
<Tr>
<td id='lockOrder' clientidmode='static' style="text-align: Right; color: black; font-weight: bold">
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' runat="server" id="img"/>
<i class="fa fa-search fa-2x cursorpointer" title="This order is locked" runat="server" id="i" Visible="False"></i>
</td>
</Tr>
</table>
CodeBehind C#
if (true)
{
img.Visible = false;
i.Visible = true;
}

Override jquery ui tooltipClass

I'm trying to override the jquery ui tooltip class so i can apply a custom class. Using knockout to bind to a span in a cell in a row in a table. But the tooltipClass is ignored. Any idea why? Jquery-ui-1.10
<div data-bind="visible:atleastOne">
<table class="mytable">
<thead>
<tr>
<th colspan="1" class="white-back" />
<th class="border-bottom" colspan="5">Orders</th>
</tr>
<tr>
<th class="title-column border-right" />
<th class="value-column">Account</th>
<th class="value-column">Amount</th>
<th class="value-column">Day</th>
<th class="value-column">Percentage</th>
<th class="value-column">Date</th>
</tr>
</thead>
<tbody data-bind="foreach: { data: items, as: 'item' }">
<!-- ko if: $parent.hasMultiple -->
<tr>
<tdborder-right" colspan="5">
<span class="bold" data-bind="text: 'Item ' + item.Code()"></span>
</td>
<td colspan="5"></td>
</tr>
<!-- /ko -->
<!-- ko foreach: { data: item.childen, as: 'child' } -->
<tr style="display: none;">
<td data-bind="attr:{ id: 'tooltip-content-' + item.code() + '-' + child.code() }">
<div data-bind="template: 'data-template', data: $data">
</div>
</td>
</tr>
<!-- ko foreach: { data: child.readOnly.subOrders, as: 'sub' } -->
<tr class="child-row" data-bind="css: { alt: $parentContext.$index() % 2 }">
<td>
<span data-bind="visible: $index() == 0, text: item.readOnly.title, tooltip: {tooltipClass: 'test', show: true, content: '#tooltip-content-' + item.code() + '-' + child.code() }"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.acc"></span>
</td>
<td class="numeric">
<span data-bind="text: sub.readOnly.amount"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.day"></span>
</td>
<td class="numeric">
<span data-bind="text: sub.readOnly.percentage"></span>
</td>
<td>
<span data-bind="text: sub.readOnly.date"></span>
</td>
</tr>
<!-- /ko -->
<!-- /ko -->
</tbody>
</table>
</div>
css
.test
{
background:pink;
}
If I add this to my stylesheet, the style is overridden wherever a tooltip is used as expected.
.ui-tooltip
{
background:blue;
}
However, I need to specify a different style on different tooltips, so this won't work for me.
I tried targeting the table itself but it doesn't work:
.mytable .ui-tooltip
{
background:pink;
}

Bootstrap table disappearing when less than 1200 pixels

I have a Bootstrap issue where my table disappears. When my page displays more than 1200 pixels wide my table shows perfectly. But when my page is shrunk to less than 1200 pixels wide my table disappears. I am not super advanced with bootstrap(not a design guy) so i am unsure what is causing the problem. I think it has something to do do with responsive tables. Also I have not edited my bootstrap.
<div class="row">
<div class="col-md-12">
<div class="panel panel-cascade">
<!-- heading-->
<div class="panel-heading text-primary">
<h3 class="panel-title">
Friends List
<span class="pull-right">
<i class="fa fa-chevron-up"></i>
<i class="fa fa-times"></i>
</span>
</h3>
</div>
<!-- body -->
<div class="panel-body">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th class="visible-lg">First Name</th>
<th class="visible-lg">Last Name</th>
<th class="visible-lg">Phone Number</th>
<th class="visible-lg">Carrier</th>
<th class="visible-lg">Send Text</th>
</tr>
</thead>
<tbody>
#foreach (var row in Model)
{
<tr>
<td class="visible-lg">
#row.FirstName
</td>
<td class="visible-lg">
#row.LastName
</td>
<td class="visible-lg">
#row.PhoneNumber###row.Carriers[0].CarrierEmail
</td>
<td class="visible-lg">
#row.Carriers[0].CarrierName
</td>
<td class="visible-lg">
#using (Html.BeginForm("SendEmail", "Admin"))
{
#Html.Hidden("Id", row.Id)
<button type="submit" class="btn btn-success"><i class="fa fa-envelope"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
I think it is because of class you are using "visible-lg", wich means visible when large, bootstrap 3 uses 4 different sizes xs, sm, md, lg. take a read at this article http://getbootstrap.com/css/.
I use this classes in my tables and they work perfect.
<table id="proviers-table" class="table table-striped table-bordered">
<thead>
<tr>
<th>Nombre</th>
<th>Teléfono</th>
<th>Correo Electrónico</th>
<th>País</th>
<th>Entidad Federativa</th>
<th>Dirección</th>
<th></th>
</tr>
</thead>
<tr>
<td>coty</td>
<td>1234567890</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<div class="btn-group">
<button class="btn btn-default btn-xs edit-provider" id="1" >
<span class="glyphicon glyphicon-pencil"></span>
</button>
<button class="btn btn-default btn-xs edit-provider" id="1">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
</td>
</tr>
<tr>
</table>
here is my view:
when small:

How can I get rounded corners to fit over other content?

I have been working on a dynamic page http://www.euroworker.no/order and I want my lovely rounded corners box (border-radius, not images) to fit over the generated products and ordrekommentar boxes. This is dynamic so I have set the HTML, and parent element of this div to height:100%;, but it just extends to the bottom of the page.
How can I get the rounded corners box to fit over the generated content?
Pris
Antall
<tr class="even first">
<td class="cartControl">
Slett
</td>
<td class="cartImage">
<a href="/Plantronics-CS361N.11">
<img src="upload/productimage/11-22-1.jpg?1249726571" alt="Plantronics CS361N" />
</a>
</td>
<td class="cartName">
<div>
Plantronics CS361N
<small>(‏Trådløse - duo)</small>
</div>
</td>
<td class="cartPrice discount">
11950.-
<div class="subTotalCalc">
5 x <span class="basePrice">2988.-</span><span class="actualPrice">2390.-</span>
</div>
</td>
<td class="cartQuant">
<input name="item_984" class="text" type="text" value="5"/>
</td>
</tr>
<tr class="odd">
<td class="cartControl">
Slett
</td>
<td class="cartImage">
<a href="/Target-7050CC-Duo-UNC.7">
<img src="upload/productimage/7-250-1.jpg?1251022192" alt="Target 7050CC Duo UNC" />
</a>
</td>
<td class="cartName">
<div>
Target 7050CC Duo UNC
<small>(‏Med ledning - duo)</small>
</div>
<div class="productOptions">
<div class="nonEditableOption">
Skal tilkobles:
Cisco
</div>
<div class="productOptionsMenu">
Endre valg
</div>
</div>
</td>
<td class="cartPrice discount">
<span class="basePrice">1124.-</span><span class="actualPrice">899.-</span>
</td>
<td class="cartQuant">
<input name="item_997" class="text" type="text" value="1"/>
</td>
</tr>
<tr class="even last">
<td class="cartControl">
Slett
</td>
<td class="cartImage">
<a href="/Sennheiser-MM-400.626">
<img src="upload/productimage/626-984-1.jpg?1264593017" alt="Sennheiser MM 400" />
</a>
</td>
<td class="cartName">
<div>
Sennheiser MM 400
<small>(‏Bluetooth headset)</small>
</div>
</td>
<td class="cartPrice discount">
<span class="basePrice">1938.-</span><span class="actualPrice">1550.-</span>
</td>
<td class="cartQuant">
<input name="item_998" class="text" type="text" value="1"/>
</td>
</tr>
<tr>
<td colspan="3" class="subTotalCaption">
Tilnærmet fraktpris:
</td>
<td class="amount shippingAmount">124.-</td>
<div id="roundbigbox">
<td id="cartUpdate"><!--<input type="submit" class="submit" value="Oppdater" />-->
<button type="submit" class="submit" id="oppdatersubmit" name="saveFields" title="Oppdater" value=""> </button> </td>
</tr>
<tr>
<td colspan="3" class="subTotalCaption">mva:</td>
<td class="amount taxAmount">3600.-</td>
</tr>
<tr>
<td colspan="3" class="subTotalCaption">Totalt:</td>
<td class="subTotal">18123.-</td>
<div id="eavContainer_556782" class="eavContainer">
<p class="required ">
<label for="product___specField_6"><span>Ordrekommentar:</span></label>
<fieldset class="error">
<div class="textarea" style="margin-left: 0;">
<textarea id="product__708_specField_6" name="specField_6" class="tinyMCE"></textarea>
<div class="errorText hidden"></div>
</div>
<div class="errorText hidden"></div>
</fieldset>
</p>
</div>
CSS
roundbigbox {
padding:10px;
width:760px;
height:1%;
border-width:1px;
border-radius:10px;
border-color:#dddddd;
-moz-border-radius:10px;
-webkit-border-radius:10px;
z-index:-1;
position:relative;
overflow:hidden;
}
<div id="products">
<div class="product">...</div>
<div class="product">...</div>
</div>
#products
{
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
position: relative;
height: 1%;
overflow: hidden;
padding: 10px;
}
You won't get the border-radius to work in IE but the box will extend dynamically to accommodate x amount of products in IE6+, FF, S, C & O

Resources