GWT FlexTable Header Column - css

I have CSS definitions for various elements around Table as shown below (Details omitted, only style names for reference).
table.entities {
border: 1px solid #c5d7ef;
border-collapse: collapse;
width: 100%;
margin-bottom: 0;
}
table.entities th, table.entities td {
padding: .25em 1.5em .5em .5em;
}
table.entities th {
font-weight: bold;
text-align: left;
background: #e5ecf9;
white-space: nowrap;
}
table.entities th a, table.entities th a:visited {
color: black;
text-decoration: none;
}
table.entities td {
background-color: #fff;
text-align: left;
vertical-align: top;
cursor: pointer;
}
table.entities tr.even td {
background-color: #f9f9f9;
}
And I apply the styles for even rows like:
flexTable.getRowFormatter().getElement(row).setClassName("even");
But for some reason, the header styles are not applied to table. Here is what I have tried
As it is I would expect th to apply style to first row, but not sure if that is a valid assumption to make
Changed the header style from th to something like theader and then explicitely applied to first row using row formatter for first row. I tried first row value as 1 & 0 both but either didn't give me results
Can anyone help me spotting where I might be going wrong?

I am pretty sure that the FlexTable does not render <th> tags. Everything is contained in the <tbody>.
You must also remember that the <tr> tag is pretty much unstylable so to style the whole row you need to apply the same style to all child <td> tags.
tr.someStyle td {
/* all styles that apply to the row */
}
If you post your actual styles and what is not being applied, maybe we can help further.

Related

Removing additional spaces in a table <td>

I have some spaces around each and every <td> in the question palette. Hereby I have attached the screenshot.
Padding is the reason that there are unexpected spaces in each td and th.
So you need to remove them.
td, th {
border: 1px solid #d8dcdd;
text-align: left;
padding: none;
}
And I am not sure but, it seems like the border is useless in your picture.
So remove it also.
td, th {
border: none;
padding: none;
}

Is there a clean way to get borders on a <tbody /> in pure CSS?

I'd like to set a background and a rounded border on a <tbody/>, such as
tbody { border-radius: 15px; border: 1px solid black; background: #ccf; }
However, when I try this in Codepen, the border and background color display, but the <tbody/> still has square corners.
I'm able to work around this problem using a series of :last-child and :first-child selectors to apply the radius to individual tds on the corners, as for example
tbody tr:first-child td:first-child { border-top-left-radius: 15px; }
This version does what I want (at least, under firefox) but also feels extremely verbose and hacky, a problem that'll only get worse when I add the prefixed versions for compatibility (-moz-, -webkit- etc), and support for <th/> elements in addition to <td/>. Is there a succinct, pure-css way of getting this behavior?
Assuming you have collapsed the borders in the table, simply set display:block on the tbody and apply the border-radius.
Codepen example
CSS
table {
width: 100%;
border-collapse: collapse;
display: block;
width: 600px;
}
tbody {
background: #ccf;
border: 1px solid black;
border-radius: 15px;
display: block;
}
th, td {
width: 200px;
}
td, th {
padding: 5px;
text-align: center;
}

Overriding CSS style in <th> element for a specific column

I'm a bit new to CSS/html. I am trying to include this jquery plugin using tablesorter that basically lets your columns sort. It looks to change the class type when the header of the table is clicked on to sort the column in ascending/descending order. I'm trying to follow this tutorial: http://weblogs.asp.net/hajan/archive/2011/02/09/table-sorting-amp-pagination-with-jquery-in-asp-net-mvc.aspx
So in one of my columns, it doesn't make sense to be able to sort since it's all the same. I'm starting with a asp.net/mvc3 application and I'm referring to the last column where you can click on "Details." Since this doesn't change I'd like to not have the up/down arrows in that column. The original css looks like:
table.tablesorter {
font-family:arial;
background-color: #CDCDCD;
margin:10px 0pt 15px;
font-size: 11pt;
width: 100%;
text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
background-color: #e6EEEE;
border: 1px solid #FFF;
font-size: 10pt;
padding: 4px;
}
table.tablesorter thead tr .header {
background-image: url(themes/base/images/bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
color: #3D3D3D;
padding: 4px;
background-color: #FFF;
vertical-align: top;
}
table.tablesorter tbody tr.odd td {
background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(themes/base/images/asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(themes/base/images/desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #8dbdd8;
}
So I thought I could add:
table.tablesorter thead .nostyle {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background-color: #8dbdd8;
}
And then in the header I don't want style, do:
<th class="#nostyle"></th>
But that doesn't work. Am I going about this correctly? Or is there a better way? Thanks!
because your class isn't right. class #nostyle does not match .nostyle. .nostyle matches elements with class="nostyle"
<th class="nostyle"></th>
Why not simply disable sorting on those columns?
http://tablesorter.com/docs/#Configuration
Look for the 'headers' setting:
headers Object null An object of instructions for per-column controls in the format: headers: { 0: { option: setting }, ... } For example, to disable sorting on the first two columns of a table: headers: { 0: { sorter: false}, 1: {sorter: false} }
If you used
table.tablesorter thead .nostyle
Your class should be 'nostyle' not '#nostyle' for ex:
<th class="nostyle"></th>

No Inline CSS in DOMPDF

I'm using DOMPDF to build out a download report of database entries for a shopping cart.
Not sure what code to put in here, it's a very typical html page with some foreach loops to display the content, and it creates the pdf just fine, but none of the css from the file is rendered as css, it gets printed as text at the top of the document.
The CSS is inline in the head of the document as any normal inline css would be.
$export_pdf ="<html><head>";
$export_pdf .="<meta http-equiv='Content-Type'
content='text/html; charset=utf-8' />";
$export_pdf .="<style type='text/css'>
.list {
border-collapse: collapse;
width: 100%;
border-top: 1px solid #DDDDDD;
border-left: 1px solid #DDDDDD;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.list td { border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; }
.list thead td { background-color: #E5E5E5; padding: 3px; font-weight: bold; }
.list tbody a { text-decoration: none; }
.list tbody td { vertical-align: middle; padding: 3px; }
.list .left { text-align: left; padding: 7px; }
.list .right { text-align: right; padding: 7px; }
table .interior,
table .interior td { border: none !important; }
table .interior tr { border-bottom: #DDD 1px solid !important; }
.list tbody .interior thead td { background: #efefef !important; }
</style>";
Then just a basic table etc.
I can't find anyone else having this issue with inline css. I've seen some posts where people have troubles getting linked styles to work, but this is simple inline css, why is it being interpreted as text instead of css?
Thanks.
-Vince
As weird as it appears, it is due to the simple quotes in the <meta> tag.
Replace them by escaped double quotes and it will work. Could you report this issue in the issue tracker please ?

Table using css

I am using the following css to mimic a table:
.table {
width: 100%;
border: 1px solid #f00;
}
.table .th {
background-color: #f00;
color: #fff;
font-weight: bold;
border-bottom: 1px dotted #f00;
}
.table .td {
display: inline-block;
width: 23%;
padding-left: 2%;
}
Is there a way to have line that will separate each row?
Thanks, Evan
Please use tables rather than recreating tables. They have a purpose. If you are creating tubular data list, like a spreadsheet, then just use a table.
This is more of a pet peeve, but it's just a waste of code that quickly becomes unmanageable.
Not too sure what the structure of your markup is but if you mimic a table row (.tr) and wrap each row of tds in it then you will have more styling control through the css.
If not, just applying a border-bottom to the td class will also work.
#seth is right too, there no no problem using tables to show data.

Resources