Forum:Sorting class problem


 * Why is this sorting not working? as how it should (pay close atention to the -23 and -25) and its place on the table after a couple sortings


 * Because the code try to figure out the "type of content" of the columns at the first cell that is not empty. The first cell it finds is "-25" and it seems not to recognize negative numbers as numbers, but as text, and makes a text sorting instead of number sorting. When it's reordered an the first cell is a positive number, then try to sort the column as numbers... The code is:

sortfn = ts_sort_caseinsensitive; if (itm.match(/^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^[\u00a3$\u20ac]/)) // pound dollar euro sortfn = ts_sort_currency; if (itm.match(/^[\d.,]+\%?$/)) sortfn = ts_sort_numeric;


 * Maybe the last match sentence must be match(/^[\d.,\-]+\%?$/) and override that function in the Common.js of the wiki. It's faster and effective than reporting a bug (like the image order bug :S) --Ciencia Al Poder (talk) -@WikiDex 08:11, 26 May 2007 (UTC)