Bonjour,
J'ai récupéré un script sur le net (je ne suis pas assez pointu en javascript) pour trier un tableau (<table>).
Sous IE => Tout est OK
Sous FF => Quel que soit l'entête de la colonne sur laquelle je clique, le tri ne se fait que sur la première colonne et l'aspect des entêtes est modifié.
Si j'enlève la ligne
Sous IE => Tout est OK
Code html : Sélectionner tout - Visualiser dans une fenêtre à part <script type="text/javascript" src="sorttable.js"></script>
Sous FF => Le tri ne se fait toujours que sur la première colonne, mais l'aspect des entêtes est conservé.
Si quelqu'un avait une idée, ce serait sympa.
Merci
Mon code et les fichiers js.
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191 <html> <head> <title> Liste </title> <style> body { font-family:Verdana,Arial,Helvetica,sans-serif; font-size:12px; text-align:left; background: #b9d3e4 url(../images/wrapper_bg.gif) top repeat-x; margin-top: 10px; margin-bottom: 10px; } </style> <link rel="stylesheet" href="style.css" /> <script type="text/javascript" src="script.js"></script> <script type="text/javascript" src="sorttable.js"></script> </head> <body onload="sorter.size(10)"> <table cellpadding="0" cellspacing="0" border="0" id="table" class="sortable" align="center"> <thead> <tr> <th><h3>Matricule</h3></th> <th><h3>Nom</h3></th> <th><h3>Prénom</h3></th> <th><h3>Direction</h3></th> <th><h3>Mail</h3></th> </tr> </thead> <tbody> <tr> <td> <font face="arial" size="2"> 01524 </font> </td> <td> <font face="arial" size="2"> Dupont </font> </td> <td> <font face="arial" size="2"> Alfred </font> </td> <td> <font face="arial" size="2"> COMPTA </font> </td> <td> <font face="arial" size="2"> alfred.dupont@societe.com </font> </td> </tr> <tr> <td> <font face="arial" size="2"> 5394 </font> </td> <td> <font face="arial" size="2"> Durand </font> </td> <td> <font face="arial" size="2"> Jacques </font> </td> <td> <font face="arial" size="2"> COMPTA </font> </td> <td> <font face="arial" size="2"> jacques.durand@societe.com </font> </td> </tr> <tr> <td> <font face="arial" size="2"> 55041 </font> </td> <td> <font face="arial" size="2"> Martin </font> </td> <td> <font face="arial" size="2"> Jean </font> </td> <td> <font face="arial" size="2"> COURRIER </font> </td> <td> <font face="arial" size="2"> jean.martin@societe.com </font> </td> </tr> <tr> <td> <font face="arial" size="2"> 70382 </font> </td> <td> <font face="arial" size="2"> Legrand </font> </td> <td> <font face="arial" size="2"> Henri </font> </td> <td> <font face="arial" size="2"> COMPTA </font> </td> <td> <font face="arial" size="2"> henri.legrand@societe.com </font> </td> </tr> </tbody> </table> <center> <div id="controls" style="text-align:center;"> <div id="perpage"> <select onchange="sorter.size(this.value)" id=select1 name=select1> <option value="5">5</option> <option selected value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> <span>Lignes par page</span> </div> <div id="navigation"> <img src="images/first.gif" width="16" height="16" alt="Première page" onclick="sorter.move(-1,true)" /> <img src="images/previous.gif" width="16" height="16" alt="Page précédente" onclick="sorter.move(-1)" /> <img src="images/next.gif" width="16" height="16" alt="Page suivante" onclick="sorter.move(1)" /> <img src="images/last.gif" width="16" height="16" alt="Dernière page" onclick="sorter.move(1,true)" /> </div> <div id="text">Page <span id="currentpage"></span> sur <span id="pagelimit"></span></div> </div> </center> <script type="text/javascript"> var sorter = new TINY.table.sorter("sorter"); sorter.head = "head"; sorter.asc = "asc"; sorter.desc = "desc"; sorter.even = "evenrow"; sorter.odd = "oddrow"; sorter.evensel = "evenselected"; sorter.oddsel = "oddselected"; sorter.paginate = true; sorter.currentid = "currentpage"; sorter.limitid = "pagelimit"; sorter.init("table",0); </script> </body> </html>
Partager