Sadly the filter_formatter
function doesn't work that way. For now, you'll have to set up the filter_formatter
before table initialization. I do plan to allow referencing a column by class or id (see issue #237), but I haven't worked out the code yet.
var filterFormatter = {};
$('table thead .date').each(function(){
var column = $(this).index(); // assuming no colspans in the row
filterFormatter[column] = function ($cell, indx){
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
textFrom: 'from', // "from" label text
textTo: 'to', // "to" label text
dateFormat: 'dd/mm/yy' ,
changeMonth: true,
changeYear : true
});
}
});
$('table').tablesorter({
widgets: ["zebra", "filter", "uitheme"],
widgetOptions : {
filter_columnFilters : true,
filter_startsWith : true,
filter_searchDelay : 300,
filter_reset : '.reset',
filter_formatter : filterFormatter
}
});