How to move tfoot at top?
I have a table as follows:
As you can see there are some search input fields with every columns at the bottom. I want to move it top. i.e: just immediate after the <thead> </thead>
.
HTML code (basic structure of table, only 2 rows is considered to share here) is:
<table class="table table-striped table-hover" id="sample_5">
<thead>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</thead>
<tfoot>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 4.0
</td>
<td>
Win 95+
</td>
<td>
4
</td>
<td>
X
</td>
</tr>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 5.0
</td>
<td>
Win 95+
</td>
<td>
5
</td>
<td>
C
</td>
</tr>
</tbody>
</table>
First I try to create a room below of thead as follows:
table.dataTable {
margin-top: 84px !important;
position: relative;
}
thead {
position: absolute;
top: -89px;
display: table-header-group;
}
Room is created as I was expecting but width of every thead cell has been changed as following picture:
Any idea?
html css html-table
add a comment |
I have a table as follows:
As you can see there are some search input fields with every columns at the bottom. I want to move it top. i.e: just immediate after the <thead> </thead>
.
HTML code (basic structure of table, only 2 rows is considered to share here) is:
<table class="table table-striped table-hover" id="sample_5">
<thead>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</thead>
<tfoot>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 4.0
</td>
<td>
Win 95+
</td>
<td>
4
</td>
<td>
X
</td>
</tr>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 5.0
</td>
<td>
Win 95+
</td>
<td>
5
</td>
<td>
C
</td>
</tr>
</tbody>
</table>
First I try to create a room below of thead as follows:
table.dataTable {
margin-top: 84px !important;
position: relative;
}
thead {
position: absolute;
top: -89px;
display: table-header-group;
}
Room is created as I was expecting but width of every thead cell has been changed as following picture:
Any idea?
html css html-table
Why don't you simply renametfoot
as anotherthead
?
– Maciej Kwas
Nov 27 '18 at 15:49
add a comment |
I have a table as follows:
As you can see there are some search input fields with every columns at the bottom. I want to move it top. i.e: just immediate after the <thead> </thead>
.
HTML code (basic structure of table, only 2 rows is considered to share here) is:
<table class="table table-striped table-hover" id="sample_5">
<thead>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</thead>
<tfoot>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 4.0
</td>
<td>
Win 95+
</td>
<td>
4
</td>
<td>
X
</td>
</tr>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 5.0
</td>
<td>
Win 95+
</td>
<td>
5
</td>
<td>
C
</td>
</tr>
</tbody>
</table>
First I try to create a room below of thead as follows:
table.dataTable {
margin-top: 84px !important;
position: relative;
}
thead {
position: absolute;
top: -89px;
display: table-header-group;
}
Room is created as I was expecting but width of every thead cell has been changed as following picture:
Any idea?
html css html-table
I have a table as follows:
As you can see there are some search input fields with every columns at the bottom. I want to move it top. i.e: just immediate after the <thead> </thead>
.
HTML code (basic structure of table, only 2 rows is considered to share here) is:
<table class="table table-striped table-hover" id="sample_5">
<thead>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</thead>
<tfoot>
<tr>
<th>
Rendering engine
</th>
<th>
Browser
</th>
<th>
Platform(s)
</th>
<th>
Engine version
</th>
<th>
CSS grade
</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 4.0
</td>
<td>
Win 95+
</td>
<td>
4
</td>
<td>
X
</td>
</tr>
<tr>
<td>
Trident
</td>
<td>
Internet Explorer 5.0
</td>
<td>
Win 95+
</td>
<td>
5
</td>
<td>
C
</td>
</tr>
</tbody>
</table>
First I try to create a room below of thead as follows:
table.dataTable {
margin-top: 84px !important;
position: relative;
}
thead {
position: absolute;
top: -89px;
display: table-header-group;
}
Room is created as I was expecting but width of every thead cell has been changed as following picture:
Any idea?
html css html-table
html css html-table
edited Nov 27 '18 at 12:30
Brian Tompsett - 汤莱恩
4,2331338101
4,2331338101
asked Nov 27 '18 at 10:19
Abdus Sattar BhuiyanAbdus Sattar Bhuiyan
1,60821539
1,60821539
Why don't you simply renametfoot
as anotherthead
?
– Maciej Kwas
Nov 27 '18 at 15:49
add a comment |
Why don't you simply renametfoot
as anotherthead
?
– Maciej Kwas
Nov 27 '18 at 15:49
Why don't you simply rename
tfoot
as another thead
?– Maciej Kwas
Nov 27 '18 at 15:49
Why don't you simply rename
tfoot
as another thead
?– Maciej Kwas
Nov 27 '18 at 15:49
add a comment |
3 Answers
3
active
oldest
votes
I wouldn't try to hack natural behaviour, for many reasons. Instead I would just make another thead block, with a structure like such:
table
| thead
| tr...
| thead
| tr...
| tbody
| tr...
add a comment |
$('table tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
add a comment |
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53497424%2fhow-to-move-tfoot-at-top%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I wouldn't try to hack natural behaviour, for many reasons. Instead I would just make another thead block, with a structure like such:
table
| thead
| tr...
| thead
| tr...
| tbody
| tr...
add a comment |
I wouldn't try to hack natural behaviour, for many reasons. Instead I would just make another thead block, with a structure like such:
table
| thead
| tr...
| thead
| tr...
| tbody
| tr...
add a comment |
I wouldn't try to hack natural behaviour, for many reasons. Instead I would just make another thead block, with a structure like such:
table
| thead
| tr...
| thead
| tr...
| tbody
| tr...
I wouldn't try to hack natural behaviour, for many reasons. Instead I would just make another thead block, with a structure like such:
table
| thead
| tr...
| thead
| tr...
| tbody
| tr...
answered Nov 27 '18 at 16:00
Maciej KwasMaciej Kwas
2,74111333
2,74111333
add a comment |
add a comment |
$('table tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
add a comment |
$('table tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
add a comment |
$('table tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
$('table tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
answered Nov 27 '18 at 10:37
Hasan TareqHasan Tareq
65111
65111
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
add a comment |
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
1
1
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
Could you add an explanation as to why that code answers the question?
– RMcLeod
Nov 27 '18 at 15:36
add a comment |
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
add a comment |
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
add a comment |
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
$('tfoot').each(function () {
$(this).insertAfter($(this).siblings('thead'));
});
tfoot {
display: table-row-group;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<thead>
<tr><td>serial</td><td>head</td></tr>
</thead>
<tbody>
<tr><td>1</td><td>100</td></tr>
<tr><td>2</td><td>20</td></tr>
<tr><td>3</td><td>300</td></tr>
<tr><td>4</td><td>800</td></tr>
<tr><td>5</td><td>100</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>2000</td></tr>
</tfoot>
</table>
answered Nov 27 '18 at 10:56
Hasan TareqHasan Tareq
65111
65111
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
add a comment |
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
Thanks for your time. in bootstrap table it does not change view based on physical place of <tfoot>. Meaning when I inspect <tfoot> is move immediate after the <thead> but the render table places tfoot at footer. I resolved this issue with an tricks (taking another table for my purpose).
– Abdus Sattar Bhuiyan
Dec 11 '18 at 6:12
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53497424%2fhow-to-move-tfoot-at-top%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why don't you simply rename
tfoot
as anotherthead
?– Maciej Kwas
Nov 27 '18 at 15:49