Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for having more than one row in thead #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
TableFixedHeader
==================

This project is cloned from https://github.com/benjaminleouzon/tablefixedheader,
but I want to implement a theme just like bootstrap, so I add `theme_bootstrap.css`
to the project.

## Usage

The code just like:

```
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="../css/jquery.fixheadertable.css" rel="stylesheet">
<link href="../css/theme_bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="../javascript/jquery.fixheadertable.js"></script>
```

And the script is:

```
<table class="fixme table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('.fixme').fixheadertable({
colratio : [100, 150, '*'],
resizeCol:true, width:600, height: 200,
theme:'bootstrap'});
});
</script>
```

You can use bootstrap table class such as: `table table-bordered table-striped table-condensed` .
7 changes: 7 additions & 0 deletions css/base.css → css/jquery.fixheadertable.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ div.t_fixed_header {
width : 100%;
}


div.t_fixed_header * {
margin : 0;
padding : 0;
}


div.t_fixed_header table.head {
position : relative;
}
Expand Down Expand Up @@ -167,6 +169,11 @@ div.t_fixed_header.ui .body tr td {
background : none;
}

div.t_fixed_header.ui .body.no-border tr td {
border : none;
background : none;
}

div.t_fixed_header.ui .body tr:last-child td {
border-bottom-width : 0px;
}
Expand Down
138 changes: 138 additions & 0 deletions css/theme_bootstrap.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* bootstrap theme*/

.ui-state-default, .ui-widget-content, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default
{background:none;border:none;}


div.t_fixed_header_main_wrapper.bootstrap {
border : 1px solid #ccc
font-weight : normal;
font-size : 1.1em;
}

div.t_fixed_header_main_wrapper.bootstrap div.t_fixed_header_caption {
text-align : center;
font-weight : bold;
padding : 0 5px;
height : 30px;
line-height : 30px;
border-width : 0 0 1px 0;
border-style : solid;
}

div.t_fixed_header_main_wrapper.bootstrap div.t_fixed_header_caption.toggle {
border-width : 0;
}

div.t_fixed_header div.headtable {
border : 0;
overflow-x : hidden;
overflow-y : auto;
}

div.t_fixed_header.bootstrap .headtable th {
padding: 8px;
color: black;
}
div.t_fixed_header.bootstrap .headtable .table-headcenter th {
text-align : center;
}
div.t_fixed_header.bootstrap .headtable .table-condensed th {
padding: 4px 5px;
}
div.t_fixed_header.bootstrap td {
padding: 8px;
}
div.t_fixed_header.bootstrap tr:first-child td {
border-top:none;
}

div.t_fixed_header.bootstrap .table-condensed td, div.t_fixed_header.bootstrap .table-condensed td{
padding: 4px 5px;
}

div.t_fixed_header.bootstrap .headtable .table-bordered {
border: none;
}

div.t_fixed_header.bootstrap .headtable .table-bordered th{
border-left: 1px solid #ccc;
}

div.t_fixed_header.bootstrap .headtable .table-bordered th:first-child{
border-left: none;
}

div.t_fixed_header.bootstrap .body table.table-bordered{
border: none;
}

div.t_fixed_header.bootstrap .body .table-bordered td{
border-left: 1px solid #ccc;
}

div.t_fixed_header.bootstrap .body .table-bordered td:first-child{
border-left: none;
}

div.t_fixed_header.bootstrap .body .table-bordered tr:last-child{
border-bottom: none;
}

div.t_fixed_header.bootstrap .headtable th span.ui-resize {
background : transparent;
cursor : col-resize;
display : inline;
float : right;
height : 20px;
margin : -3px -5px -5px 0;
width : 5px;
z-index : 10000;
}

div.t_fixed_header div.body {
border-top: 1px solid #ccc;
}

div.t_fixed_header.bootstrap div.ui-resize-ghost {
display : none;
position : absolute;
top : 0;
width : 2px;
border : none;
}

div.t_fixed_header_main_wrapper.ui-widget-header{
background: transparent;
border: 1px solid #ccc;
}

div.t_fixed_header_main_wrapper.bootstrap div.pager {
border-width : 0 0 0 0;
padding : 4px 2px 2px 3px;
overflow : hidden;
background-image: none;
}

div.t_fixed_header_main_wrapper.bootstrap div.pager .button {
float : right;
padding : 4px 0;
cursor : pointer;
}

div.t_fixed_header_main_wrapper.bootstrap div.pager .button.noborder {
border-right-width : 0px;
}

div.t_fixed_header_main_wrapper.bootstrap div.pager .button span {
margin : 0 4px;
}

div.t_fixed_header_main_wrapper.bootstrap div.pager div.page_infos {
height : 27px;
line-height : 27px;
float : right;
margin-right : 10px;
font-weight : normal;
}

144 changes: 144 additions & 0 deletions demo/bootstrap_demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!doctype html>
<html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<head>
<title>Bootstrap Demo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="../css/jquery.fixheadertable.css" rel="stylesheet">
<link href="../css/theme_bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="../javascript/jquery.fixheadertable.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$('.fixme').fixheadertable({
// wrapper: false,
colratio : [100, 150, '*'],
resizeCol:true, width:600, height: 200, theme:'bootstrap'});
});
</script>

<!-- some code here -->

<!-- IN THE BODY SECTION -->

<table class="fixme table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>AAA</td>
<td>BBB</td>
<td>CCC</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>
<tr>
<td>XXX</td>
<td>YYY</td>
<td>ZZZ</td>
</tr>

</tbody>
</table>
</body>
</html>
Loading