przerobilem jakis inny skrypt jquery i cos sie popierniczylo, ze nie sortuje:
<?php $.fn.alternateRowColors = function() { $('tbody tr:odd', this).removeClass('even').addClass('odd'); $('tbody tr:even', this).removeClass('odd').addClass('even'); return this; }; $(document).ready(function() { var alternateRowColors = function($table) { $('tbody tr:odd', $table).removeClass('even').addClass('odd'); $('tbody tr:even', $table).removeClass('odd').addClass('even'); }; var $table = $(this); $table.alternateRowColors($table); var findSortKey; if($(this).is('.sort-alpha')) { findSortKey = function($cell) { return $cell.find('.sort-key').text().toUpperCase() + ' ' + $cell.text().toUpperCase(); }; } else if($(this).is('.sort-numeric')) { findSortKey = function($cell) { }; } else if($(this).is('.sort-date')) { findSortKey = function($cell) { var dateTest = [ { regExp:/^(0?[1-9]|1[012])([- /.])(0?[1-9]|[12][0-9]|3[01])([- /.])((dd)?dd)$/, d:3, m:1, y:5 }, // mdy { regExp:/^(0?[1-9]|[12][0-9]|3[01])([- /.])(0?[1-9]|1[012])([- /.])((dd)?dd)$/, d:1, m:3, y:5 }, // dmy { regExp:/^(dddd)([- /.])(0?[1-9]|1[012])([- /.])(0?[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 } // ymd ]; var start, cnt = 0, numFormats = dateTest.length; while(cnt < numFormats) { start = (cnt + (favourDMY ? numFormats + 1 : numFormats)) % numFormats; if(dateIn.match(dateTest[start].regExp)) { res = dateIn.match(dateTest[start].regExp); y = res[dateTest[start].y]; m = res[dateTest[start].m]; d = res[dateTest[start].d]; if(m.length == 1) m = "0" + String(m); if(d.length == 1) d = "0" + String(d); if(y.length != 4) y = (parseInt(y) < 50) ? "20" + String(y) : "19" + String(y); }; cnt++; }; return 0; }; } if(findSortKey) { $(this).addClass ('clickable').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }).click(function() { var rows = $table.find('tbody > tr').get(); row.sortKey = findSortKey($(row).children('td').eq(column)); }); if(a.sortKey < b.sortKey) return -1; if(a.sortKey > b.sortKey) return 1; return 0; }); $table.children('tbody').append(row); row.sortKey = null; }); $table.alternateRowColors($table); }); } }); }); }); ?>
moze ktos zauwazy w czym problem ? (chodzi wylacznie o sortowanie wg daty)