Skip to content

Instantly share code, notes, and snippets.

@hrp
Created July 6, 2012 00:38
Show Gist options
  • Save hrp/3057331 to your computer and use it in GitHub Desktop.
Save hrp/3057331 to your computer and use it in GitHub Desktop.
Sort by button text in jQuery DataTables
// Custom sorting function to sort paid/unpaid claims
$.fn.dataTableExt.afnSortData['button-text'] = function ( oSettings, iColumn )
{
var aData = [];
$( 'td:eq('+iColumn+') button', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.text );
} );
return aData;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment