| | |
|
|
|
Please check table sort in Windows |
| message from Mick White on 19 Jul 2004 |
http://www.mickweb.com/football/aleague/profiles.html
There are seven sortable and togglable columns (a second click should
reverse the order):
#: Sort by jersey number
P: Sort by field position: G D M L or reverse
Name: Sort by last name, or by first name, if no last name ("Neto").
HT: Sort by height
WT: Sort by weight
DOB: Sort by date of birth
Hometown: Alphabetic sort.
And the table row colours alternate between a light bluish green and
white, and should remain so after sort.
Thanks.
Mick
|
| Gary White replied to Mick White on 19 Jul 2004 |
When the page first loads, the order appears to be sorted by name (last and
then first). If you click the name column it improperly reverses the order
of the two Wilsons so that Kirk is listed before John. Click the name column
again and the reverse sort looks right. Click the name column again for an
ascending sort and John is listed before Kirk.
After the page first loads, clicking some columns gives an ascending order
sort. Other columns, if clicked first, give a descending order sort. I
didn't spend a lot of time trying to figure the logic of why they react
differently.
Row coloring seemed to work correctly.
Gary
|
| Gary White replied to Mick White on 19 Jul 2004 |
Clicking any column except height and weight, when the page first loads,
will sort in ascending order. Clicking the height or weight will sort in
descending order. I see what you're doing, but it would seem more intuitive
to just sort them all in ascending order first. That's really being kind of
picky on my part. It all appears to work well in both Firefox and IE6 on
this WinXP machine.
Gary
|
| Mick White replied to Gary White on 19 Jul 2004 |
Thanks, Gary.
The first(default) sort of a column can be either ascending and
descending. I chose descending for height and weight (as well as for
name, dob and hometown), it just seemed logical for me.
Mick.
Gary White wrote:
|
| Gary White replied to Mick White on 20 Jul 2004 |
You're welcome, Mick. No problem. Like I said, it was getting pretty
picky on my part. Looks like it will be very handy once you get the name
sort finished up.
Gary
|
| Mick White replied to Gary White on 20 Jul 2004 |
That's done, really quite simple (GlobActiveColumn is the number of the
column clicked ):
function sortByLastNames(a,b){
var col1 = a.getElementsByTagName("TD").item(GlobActiveColumn);
var col2 = b.getElementsByTagName("TD").item(GlobActiveColumn);
var text1 =
col1.firstChild.data.split(" ")[1]? // is there a last name?
col1.firstChild.data.split("")[1]:col1.firstChild.data;
var text2 =
col2.firstChild.data.split(" ")[1] ?
col2.firstChild.data.split("")[1]:col2.firstChild.data;
// added the following
if(text1==text2){// if last names are the same
text1=col1.firstChild.data; // sort by the full name
text2=col2.firstChild.data;
}
if (text1 < text2)
return gbAscending ? -1 : 1;
else if (text1 > text2)
return gbAscending ? 1 : -1;
else return 0;
}
Mick
|
| Gary White replied to Mick White on 20 Jul 2004 |
Okay. I didn't test it this time around because you said it wasn't done
yet. Looks like it's working now.
Good job!
Gary
|
| ana replied to Mick White on 19 Jul 2004 |
hi Mike
its working fine here in windows 2000, ie 6.0
who the hell is Carlos Semedo from Portugal? *grrrrrrrrrrrrr*
ana
|
| terry replied to Mick White on 19 Jul 2004 |
Windows 98 SE
IE6
Firefox 0.9
No problems with sort or colours.
Nice work.
Terry
|
|
Archived message: Please check table sort in Windows (Macromedia Dreamweaver Web Design)