JQuery tablesorter - Second click on column header doesn't resort
Posted
by Jonathan
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan
Published on 2010-06-05T14:34:38Z
Indexed on
2010/06/05
15:02 UTC
Read the original article
Hit count: 266
django-admin
|tablesorter
I'm using tablesorter in on a table I added to a view in django's admin (although I'm not sure this is relevant). I'm extending the html's header:
{% block extrahead %}
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script type="text/javascript" src="http://mysite.com/media/tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{ $("#myTable").tablesorter(); }
);
</script>
{% endblock %}
When I click on a column header, it sorts the table using this column in descending order - that's ok.
When I click the same column header a second time - it does not reorder to ascending order. What's wrong with it?
the table's html looks like:
<table id="myTable" border="1">
<thead>
<tr>
<th>column_name_1</th>
<th>column_name_2</th>
<th>column_name_3</th>
</tr>
</thead>
<tbody>
{% for item in extra.items %}
<tr>
<td>{{ item.0|safe }} </td>
<td>{{ item.1|safe }} </td>
<td>{{ item.2|safe }} </td>
</tr>
{% endfor %}
</tbody>
</table>
© Stack Overflow or respective owner