bradvin/FooTable — pull request #204 by lzilioli (2014-03-12 04:07:18+00:00)
Title: Ability to pass textExtractor as an option to footable

This enables the programmer to override the normal text parsing behavior in footable, and instead provide a function that, given a cell within the table, returns the 'sort value'.

In my current implementation, when this feature is used, the parser is forced to aplha. This may not be the best decision, as the textExtractor could reasonably extract numerical values, etc.

I realize this is likely not ready to pull in its existing state, but I would be happy to respond to any feedback to make this pull-ready. Thanks.

Example of a textExtractor:

Usage: `$( '.footable' ).footable({ textExtractor: myTextExtractor });`

function myTextExtractor( node ) {
var $td = $( node );
var text = '';

if (
$td.is( '.classA' ) ||
$td.is( '.classB' ) ||
$td.is( '.classC' )
) {
text = $td.find( 'span.rowScore' ).attr( 'data-original-title' );
} else if (
$td.is( '.classD' ),
$td.is( '.classE' ),
) {
text = $td.find( 'inpt[type="text"]' ).val();
} else if (
$td.is( '.classF' )
) {
text = $td.find( 'option:selected' ).val();
} else {
text = $td.text();
}

if ( !text ) {
text = '';
}
return text.trim();
}