Hi,
the algorithm looks good, when getTime() returns really a Number and not
a String. To ensure that you are comparing Numbers and not Strings use:
sortAnnotations : function(a1,a2) {
a1 = parseFloat(a1.getTime());
a2 = parseFloat(a2.getTime());
if(a1 == a2) {
return 0;
} else {
if(a1 > a2) {
return 1;
} else {
return -1;
}
}
}
This should also work:
sortAnnotations : function(a1,a2) {
return a1.getTime() - a2.getTime();
}
Cheers,
Chris
Am 26.04.2011 12:07, schrieb tizio85:
> Mmm.. infact it's possible I did mistakes in the sort function.
> The sort is done by the time field, a float containing a grand total of
> seconds (raw seconds, without minutes and/or hours).
>
> This is the code:
>
> sortAnnotations : function(a1,a2) {
> if(a1.getTime() == a2.getTime()) return 0;
> else
> if(a1.getTime()> a2.getTime()) return 1;
> else return -1;
> }
>
>
>
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/how-to-use-dinamically-created-class-tp6299292p6305192.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel