DataTables complex header example (rowspan and colspan)

Preamble

Complex headers (using colspan / rowspan) can be used to group columns of similar information in DataTables, creating a very powerful visual effect. In addition to the basic behaviour, DataTables can also take colspan and rowspans into account when working with hidden columns. The colspan and rowspan attributes for each cell are automatically calculated and rendered on the page for you. This also allows the ColVis extra for DataTables to work great with hidden columns.

Live example

Rendering engineBrowserDetails
Engine versionCSS grade
Rendering engineBrowserEngine versionCSS grade
Details
Gecko Firefox 1.0 1.7 A
Gecko Firefox 1.5 1.8 A
Gecko Firefox 2.0 1.8 A
Gecko Firefox 3.0 1.9 A
Gecko Camino 1.0 1.8 A
Gecko Camino 1.5 1.8 A
Gecko Netscape 7.2 1.7 A
Gecko Netscape Browser 8 1.7 A
Gecko Netscape Navigator 9 1.8 A
Gecko Mozilla 1.0 1 A
Showing 1 to 10 of 57 entries

Initialisation code

$(document).ready(function() {
	$('#example').dataTable( {
		"aoColumnDefs": [
			{ "bVisible": false, "aTargets": [2] }
		]
	} );
} );

Other examples