Skip to content

Commit 2e26567

Browse files
committed
Fix for Issue #3 - Added support for tfoot
Added support for fixed footer (tfoot) element
1 parent d060191 commit 2e26567

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

angu-fixed-header-table.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,24 @@
1717
function (newValue, oldValue) {
1818
if (newValue === true) {
1919
// reset display styles so column widths are correct when measured below
20-
$elem.find('thead, tbody').css('display', '');
20+
$elem.find('thead, tbody, tfoot').css('display', '');
2121

2222
// wrap in $timeout to give table a chance to finish rendering
2323
$timeout(function () {
2424
// set widths of columns
2525
$elem.find('th').each(function (i, thElem) {
2626
thElem = $(thElem);
2727
var tdElems = $elem.find('tbody tr:first td:nth-child(' + (i + 1) + ')');
28+
var tfElems = $elem.find('tfoot tr:first td:nth-child(' + (i + 1) + ')');
2829

2930
var columnWidth = tdElems.width();
3031
thElem.width(columnWidth);
3132
tdElems.width(columnWidth);
33+
tfElems.width(columnWidth);
3234
});
3335

3436
// set css styles on thead and tbody
35-
$elem.find('thead').css({
37+
$elem.find('thead, tfoot').css({
3638
'display': 'block',
3739
});
3840

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angu-fixed-header-table",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"authors": [
55
"Jason Watmore <jason@pointblankdevelopment.com.au> (http://jasonwatmore.com)"
66
],

demo/demo.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
<td>Row {{item}} Col 4</td>
2626
</tr>
2727
</tbody>
28+
<tfoot>
29+
<tr>
30+
<td>Footer 1</td>
31+
<td>Footer 2</td>
32+
<td>Footer 3</td>
33+
<td>Footer 4</td>
34+
</tr>
35+
</tfoot>
2836
</table>
2937

3038
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>

0 commit comments

Comments
 (0)