From: Barış Metin Date: Thu, 2 Jul 2009 14:25:53 +0000 (+0000) Subject: sort function for Last Contact columns X-Git-Tag: PLEWWW-4.3-23~3 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0cfa96df3414e1f9da54888f74cabb4083701580;p=plewww.git sort function for Last Contact columns --- diff --git a/plekit/table/table.css b/plekit/table/table.css index c164981..1ba1fe6 100644 --- a/plekit/table/table.css +++ b/plekit/table/table.css @@ -62,6 +62,7 @@ th.sortable-sortScientificNotation, th.sortable-sortImage, th.sortable-sortFileSize, th.sortable-sortBandwidth, +th.sortable-sortLastContact, th.sortable-sortAlphaNumeric, th.sortable-sortEnglishDateTime { cursor:pointer; diff --git a/plekit/tablesort/customsort.js b/plekit/tablesort/customsort.js index a31af9e..4155b2b 100644 --- a/plekit/tablesort/customsort.js +++ b/plekit/tablesort/customsort.js @@ -380,3 +380,33 @@ function sortBandwidthPrepareData(td, innerText) { return isNaN(innerText) ? "" : innerText * mult; }; + + +var sortLastContact = fdTableSort.sortNumeric; + +function sortLastContactPrepareData(td, innerText) { + var regExp = /(min|hrs|days|wks|mnths)/i; + + var type = innerText.search(regExp) != -1 ? innerText.match(regExp)[0] : ""; + + switch (type.toLowerCase()) { + case "hrs" : + mult = 60; + break; + case "days" : + mult = 60*24; + break; + case "wks" : + mult = 60*24*7; + break; + case "mnths" : + mult = 60*24*30; + break; + default : + mult = 1; + }; + + innerText = parseFloat(innerText.replace(/[^0-9\.\-]/g,'')); + + return isNaN(innerText) ? "" : innerText * mult; +}; \ No newline at end of file