add sortable data to table, and re odd/even columns after a filter (#1088)

This commit is contained in:
Frédéric Péters 2011-12-01 23:46:51 +01:00
parent bf078ff20a
commit ef52b1452b
1 changed files with 15 additions and 8 deletions

View File

@ -67,21 +67,22 @@
<table id="deputy-table" class="listing">
<thead>
<th class="name nosort">Nom / Prénom</th>
<th class="name">Nom / Prénom</th>
<th class="polgroup">Groupe</th>
<th class="arrond">Arrondissement</th>
<th class="birth nosort">Naissance</th>
<th class="birth">Naissance</th>
</thead>
<tbody>
<tr tal:repeat="entry view/sortedDeputies">
<td class="name"><a tal:attributes="href entry/id">
<td tal:attributes="class string:name sortabledata-${entry/sortname}"><a tal:attributes="href entry/id">
<span class="lastname" tal:content="entry/lastname"/>
<span class="firstname" tal:content="entry/firstname"/></a></td>
<td class="polgroup">
<span tal:condition="entry/polgroup" tal:attributes="class string:${entry/polgroup/to_object/id}" tal:content="entry/polgroup/to_object/title"></span>
</td>
<td class="arrond" tal:content="entry/district"></td>
<td class="birth" tal:content="entry/formatted_birthdate"></td>
<td tal:attributes="class string:polgroup sortabledata-${entry/polgroup/to_object/id}"
tal:condition="entry/polgroup">
<span tal:attributes="class entry/polgroup/to_object/id" tal:content="entry/polgroup/to_object/title"></span>
</td><td tal:condition="not: entry/polgroup"></td>
<td tal:attributes="class string:arrond sortabledata-${entry/district}" tal:content="entry/district"></td>
<td tal:attributes="class string:birth sortabledata-${entry/birthdate}" tal:content="entry/formatted_birthdate"></td>
<td style="display: none" class="agerange"><span tal:attributes="class entry/agerange"/></td>
</tr>
</tbody>
@ -165,6 +166,12 @@ jq('#deputy-search div a').click(
});
jq('#form-name input').keyup(refreshtable);
jq(function() {
/* we bind it later, after table_sorter.js had its turn
(this is probably fragile) */
jq('table.listing:not(.nosort) thead th:not(.nosort)').click(
function() { console.log('ref'); refreshtable(); });
});
refreshtable();