I have a sample html table like this
我有一个像这样的样本html表
<table class="statisticsTable" id="myTable">
<tr>
<th colspan="6">This is heading</th>
</tr>
<thead>
<tr>
<th>Member Num</th>
<th>Member First Name</th>
<th>Member Last Name</th>
<th>Date of Birth</th>
<th>Age</th>
<th>Relationship</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top">123456</td>
<td>test1</td>
<td>test1 ln</td>
<td>06/14/1984</td>
<td>24</td>
<td>awesome</td>
</tr>
<tr>
<td valign="top">654321</td>
<td>test2</td>
<td>test2 ln</td>
<td>06/21/1984</td>
<td>42</td>
<td>awesome1</td>
</tr>
<tr>
<td valign="top">954712</td>
<td>test3</td>
<td>test3 ln</td>
<td>06/14/1956</td>
<td>66</td>
<td>awesome0</td>
</tr>
</tbody>
the tableSorter plugin does sorting on everything inside the <thead>
tag. Thats why all my column headers are inside it. However, I am having a problem with the 'This is Heading'. It is appearing AFTER the columns. I want it to appear before the columns. And I can not put it in <thead>
as I do not wish for it to be included in the sorting.
tableSorter插件对标记内的所有内容进行排序。这就是为什么我的所有列标题都在其中。但是,我遇到了'This is Heading'的问题。它出现在列之后。我希望它出现在列之前。我不能把它放在中,因为我不希望它被包含在排序中。
What is the alternative?
有什么选择?
2 个解决方案
#1
figured it out. I can put the heading inside the thead and just disable sorting on that column like this example
弄清楚了。我可以将标题放在thead中,只是禁用该列的排序,就像这个例子一样
#2
Perhaps, instead of using another row for the "This is heading", use a <caption>
element?
也许,使用元素而不是使用另一行“This is heading”?
So: <caption>This is heading</caption>
所以:这是标题
#1
figured it out. I can put the heading inside the thead and just disable sorting on that column like this example
弄清楚了。我可以将标题放在thead中,只是禁用该列的排序,就像这个例子一样
#2
Perhaps, instead of using another row for the "This is heading", use a <caption>
element?
也许,使用元素而不是使用另一行“This is heading”?
So: <caption>This is heading</caption>
所以:这是标题