Sort by attribute (e.g. title or rel) not raw cell data

Sort by attribute (e.g. title or rel) not raw cell data

suntropsuntrop Posts: 4Questions: 0Answers: 0
edited January 2012 in DataTables 1.8
I've got two columns – duration and due date – that I can't sort, because of its formatting. Hope DataTables can handel it …

Column A displays a duration: 30min, 60min, 90min … but higher durations are displayed in hours 2h, 4h …
Currently it sorts like 10min, 2h, 30min, 60min
Is it possible to sort not the raw data, but the title, a rel or another attribute? So I can pass the duration only in minutes and sort this.

Column B displays due dates: 1. Jan, tomorrow, monday, friday, 27. Jan …
Like in column A I would like to put the raw data (2012-01-01) into a table cell attribute and sort it by this.

Hope you know what I mean :-)

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi,

    Have a look at my reply here which describes the options for this functionality in DataTables: http://datatables.net/forums/discussion/7991/sorting-plug-ins-not-working#Item_3

    Allan
  • suntropsuntrop Posts: 4Questions: 0Answers: 0
    Allan, thanks for your answer and the link.

    I think I wait for v1.9 :-) , because I am not such familiar with JS. Maybe I can copy and paste the code where you used an extra span. That wouldn't be the problem and I can put in the raw minutes/dates.

    Cross your fingers for me :-D

    Thanks again!
This discussion has been closed.