DataTables HTML sorting example

Preamble

With DataTables you can specify what the data type of a particular column is. This will effect how the sorting of that column is done. For example date stamps ('date'), numeric ('numeric') data and strings (default) are all sorted differently. The fourth type is 'html' which will strip the HTML tags from a string (you typically wouldn't want to sort on them since they are invisible to the user) and will sort the resulting blank string. This shows and example of that where the two links to 'Integrity' are identical but the link with the text 'A ...' will come top of the list when sorted upon, and the link with the text 'Integrity' will come bottom of the list.

Live example

Reflection Link
DataTables DataTables
Integrity A link to Integrity
Integrity Integrity

Initialisation code

$(document).ready(function() {
	$('#example').dataTable( {
		"aoData": [
			null,
			{ "sType": "html" }
		]
	} );
} );

Other examples

Basic initialisation

Advanced initialisation

API

Please refer to the DataTables documentation for full information about it's API properties and methods.