Public feed #891329

Unnamed

public text v1 · immutable
Raw Edit
·published 2008-02-04 15:41 UTC
rendered paste body
   $.tablesorter.addParser({ 
        id: 'nums', 
        is: function(s) { return false; }, 
        format: function(s) { 
			return s.toLowerCase().replace(/\-/,-1);
        }, 
        type: 'numeric' 
    }); 
	
	$.tablesorter.addParser({ 
        id: 'rating', 
        is: function(s) { return true; }, 
        format: function(s) { 	
            var regex = new RegExp('<span id="(.*?)">(.*?)<\/span>');
            var match = regex.exec(s);
            return match == null ? 0 : match[2];
        }, 
        type: 'numeric' 
    });  


    $("table#tblResults").tablesorter({widgets: ['zebra'],headers: {1: {sorter:'rating'}}});
    $("table#tblResults").tablesorter({widgets: ['zebra'],headers: {2: {sorter:'nums'}}});
    $("table#tblResults").tablesorter({widgets: ['zebra'],headers: {3: {sorter:'nums'}}});
    $("table#tblResults").tablesorter({widgets: ['zebra'],headers: {4: {sorter:'nums'}}});