I would advise you to convert your date string to a date object [1] in your 
data model. Then use the date cellrendrer and the table widget does the rest 
[2] ;)


[1] 
http://demo.qooxdoo.org/current/apiviewer/#qx.util.format.DateFormat~parse!method_public
[2] http://demo.qooxdoo.org/devel/demobrowser/index.html#table~Table.html


regards

Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe

-----Ursprüngliche Nachricht-----
Von: pedropielle [mailto:[email protected]] 
Gesendet: Montag, 10. Dezember 2012 10:08
An: [email protected]
Betreff: [qooxdoo-devel] sorting table by date

I would like to know wich is the rigth method to sort a table data by a column 
which contains dates.

I used, as last solution,
        tbl.getTableModel().setSortMethods(0, {
                ascending  : this.sortAscDate,
                descending : this.sortDescDate
        });

where:
        sortAscDate: function(row1, row2){
                var obj1 = row1[arguments.callee.columnIndex];
                var obj2 = row2[arguments.callee.columnIndex];
                var aDate = obj1.split("-");
                var v1=aDate[2]+aDate[1]+aDate[0];
                v1=parseInt(v1);
                var aDate = obj2.split("-");
                var v2=aDate[2]+aDate[1]+aDate[0];
                v2=parseInt(v2);
                return (v1 > v2);
        },

(each cell, coming from a json, is formatted  like dd-mm-YYYY).

Another idea is adopting a hidden column containing the same dates in 
microseconds, but i don't know how to do it.

I'working on this problem, tring different solutions, from two days.

pielle



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/sorting-table-by-date-tp7582236.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely 
access PCs and mobile devices and provide instant support Improve your 
efficiency, and focus on delivering more value-add services Discover what IT 
Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to