|
[ - ]
Track FIFA World Cup 2006 Groups & Standings.
Comments About this Klipre: gd wrong order & refresh lacks reorderPosted by
awille
on (2006-06-12)
Thanks ... just updated to version 3.04
Related KlipsSetsThis Klip belongs to the following sets: TagsThis Klip uses the following tags: |
gd wrong order & refresh lacks reorder
function compareItems(item1, item2)
{
var points1 = parseInt(item1.getData("points"));
var points2 = parseInt(item2.getData("points"));
var gf1 = parseInt(item1.getData("goalsFor"));
var gf2 = parseInt(item2.getData("goalsFor"));
var ga1 = parseInt(item1.getData("goalsAgainst"));
var ga2 = parseInt(item2.getData("goalsAgainst"));
var gd1 = gf1 - ga1;
var gd2 = gf2 - ga2;
if (points1 > points2)
{
return -1;
}
else if (points1 < points2)
{
return 1;
}
else
{
if (gd1 > gd2)
{
return -1;
}
else if (gd1 < gd2)
{
return 1;
}
else
{
if (gf1 > gf2)
{
return -1;
}
else if (gf1 < gf2)
{
return 1;
}
else
{
return 0;
}
}
}
}
also there seems to be a bug in reordering when results are refresehed it seems reordering is not done
so I changed position of Items.sort(compareItems); in:
function onRefresh()
{
...
}
Items.sort(compareItems);
return success;
}