How to add sorting to table without plugin on blog.wordpress.com site?
-
Hello,
I am trying to add a table to a post using HTML in the “text” post tab, but I cannot make the columns sortable.
The first table on this page shows what I am trying to do: Example TableI have tried copying that table’s code, and while the table formats and fills correctly, the sorting doesn’t appear or work. The code that table uses is:
<table class=”sortable”>
<thead><th class=”header headerSortDown”>Athlete</th>
<th class=”header”>Age</th>
<th class=”header”>Country</th>
<th class=”header”>Gold Medals</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cao Yuan</td>
<td>17</td>
<td>China</td>
<td>1</td>
</tr>
<tr>
<td>Chen Ruolin</td>
<td>19</td>
<td>China</td>
<td>2</td>
</tr>
<tr>
<td>David Boudia</td>
<td>23</td>
<td>United States</td>
<td>1</td>
</tr>
<tr>
<td>He Zi</td>
<td>21</td>
<td>China</td>
<td>1</td>
</tr>
<tr>
<td>Ilya Zakharov</td>
<td>21</td>
<td>Russia</td>
<td>1</td>
</tr>
<tr>
<td>Luo Yutong</td>
<td>26</td>
<td>China</td>
<td>1</td>
</tr>
<tr>
<td>Qin Kai</td>
<td>26</td>
<td>China</td>
<td>1</td>
</tr>
<tr>
<td>Wang Hao</td>
<td>19</td>
<td>China</td>
<td>1</td>
</tr>
<tr>
<td>Wu Minxia</td>
<td>26</td>
<td>China</td>
<td>2</td>
</tr>
<tr>
<td>Zhang Yanquan</td>
<td>18</td>
<td>China</td>
<td>1</td>
</tr>
</tbody>
</table>Any help is greatly appreciated. If it is not possible, are there any ways to make a sortable table on a .com site? Please note that I am a complete novice to WP and HTML.
Thank youThe blog I need help with is: (visible only to logged in users)
-
So I wasn’t able to get this code to work, and I wasn’t able to get the same code copied directly from the source page of your example to work either.
What’s even stranger is I couldn’t get it to work in WordPress.com, a self-hosted WordPress site, or Komodo Edit–a program specifically for writing and testing HTML/CSS code.
Which is a long way of saying you’ve stumped me. I’ll mark the thread for staff assistance and see if one of the Happiness Engineers can let us know what we are missing.
-
-
Hi there,
I’ve tested the script that was provided pretty extensively now both in WordPress.com and WordPress.org and I have not yet gotten it to work as described. It should be noted that the site which is describing how to build out a WordPress site is itself not built on WordPress, so the fact that it is working there doesn’t mean that the snippet of code works in the WordPress environment.
Tables themselves definitely work great, but we do not appear to support the sorting or search functions which they are speaking about. I’m sorry for the inconvenience!
-
Darn. Any way to get those features implemented as standard?
Thank you for your response. -
Not immediately, no. I can put in a suggestion to have it looked at for a future improvement. Of course such suggestions are not guaranteed for when or even if they’ll be put in place, but at least they’ll get looked at by our developers!
I’ll put it in place now. :)
- The topic ‘How to add sorting to table without plugin on blog.wordpress.com site?’ is closed to new replies.