view DataTables-1.9.4/extras/FixedColumns/row_grouping.html @ 8:86219e4aa239 draft

Uploaded
author saskia-hiltemann
date Mon, 28 Aug 2017 10:23:21 -0400
parents ac5f9272033b
children
line wrap: on
line source

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8">
		<link rel="shortcut icon" type="image/ico" href="http://www.sprymedia.co.uk/media/images/favicon.ico">
		
		<title>FixedColumns example</title>
		<style type="text/css" title="currentStyle">
			@import "../../media/css/demo_page.css";
			@import "../../media/css/demo_table.css";
			.FixedColumns_Cloned th { background-color: white; }
			td.index { background-color: white; border-right: 1px solid black; }
			table.display th.sorting_disabled { border-bottom: 1px solid white; }
		</style>
		<script type="text/javascript" charset="utf-8" src="../../media/js/jquery.js"></script>
		<script type="text/javascript" charset="utf-8" src="../../media/js/jquery.dataTables.js"></script>
		<script type="text/javascript" charset="utf-8" src="media/js/FixedColumns.js"></script>
		<script type="text/javascript" charset="utf-8">
			$(document).ready( function () {
				var oTable = $('#example').dataTable( {
					"sScrollY": "300px",
					"sScrollX": "100%",
					"sScrollXInner": "150%",
					"bScrollCollapse": true,
					"bPaginate": false,
					"aaSortingFixed": [ [1, 'asc'] ],
					"aoColumnDefs": [
						{ "bVisible": false, "aTargets": [1] }
					]
				} );

				new FixedColumns( oTable, {
					"fnDrawCallback": function ( left, right ) {
						var oSettings = oTable.fnSettings();
						if ( oSettings.aiDisplay.length == 0 )
						{
							return;
						}

						var nGroup, nCell, iIndex, sGroup;
						var sLastGroup = "", iCorrector=0;
						var nTrs = $('#example tbody tr');
						var iColspan = nTrs[0].getElementsByTagName('td').length;

						for ( var i=0 ; i<nTrs.length ; i++ )
						{
							iIndex = oSettings._iDisplayStart + i;
							sGroup = oSettings.aoData[ oSettings.aiDisplay[iIndex] ]._aData[1]			;
							
							if ( sGroup != sLastGroup )
							{
								/* Cell to insert into main table */
								nGroup = document.createElement( 'tr' );
								nCell = document.createElement( 'td' );
								nCell.colSpan = iColspan;
								nCell.className = "group";
								nCell.innerHTML = "&nbsp;";
								nGroup.appendChild( nCell );
								nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );

								/* Cell to insert into the frozen columns */
								nGroup = document.createElement( 'tr' );
								nCell = document.createElement( 'td' );
								nCell.className = "group";
								nCell.innerHTML = sGroup;
								nGroup.appendChild( nCell );
								$(nGroup).insertBefore( $('tbody tr:eq('+(i+iCorrector)+')', left.body)[0] );

								iCorrector++;
								sLastGroup = sGroup;
							}
						}
					}
				} );
			} );
		</script>
	</head>
	<body id="dt_example">
		<div id="container">
			<div class="full_width big">
				FixedColumns example - row grouping
			</div>
			
			<h1>Preamble</h1>
			<p>This example is designed to re-implement the visual effect of the DataTables <a href="http://datatables.net/examples/advanced_init/row_grouping.html">row grouping example</a> with a fixed column. It is alternative row grouping style to that presented in the <a href="grouping.html">row grouping by height</a> example.</p>
			
			<h1>Live example</h1>
			<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
	<thead>
		<tr>
			<th>Browser</th>
			<th>Rendering engine</th>
			<th>Platform(s)</th>
			<th>Engine version</th>
			<th>CSS grade</th>
		</tr>
	</thead>
	<tbody>
		<tr class="gradeX">
			<td>Internet
				 Explorer 4.0</td>
			<td>Trident</td>
			<td>Win 95+</td>
			<td class="center">4</td>
			<td class="center">X</td>
		</tr>
		<tr class="gradeC">
			<td>Internet
				 Explorer 5.0</td>
			<td>Trident</td>
			<td>Win 95+</td>
			<td class="center">5</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeA">
			<td>Internet
				 Explorer 5.5</td>
			<td>Trident</td>
			<td>Win 95+</td>
			<td class="center">5.5</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Internet
				 Explorer 6</td>
			<td>Trident</td>
			<td>Win 98+</td>
			<td class="center">6</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Internet Explorer 7</td>
			<td>Trident</td>
			<td>Win XP SP2+</td>
			<td class="center">7</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>AOL browser (AOL desktop)</td>
			<td>Trident</td>
			<td>Win XP</td>
			<td class="center">6</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Firefox 1.0</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.2+</td>
			<td class="center">1.7</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Firefox 1.5</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.2+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Firefox 2.0</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.2+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Firefox 3.0</td>
			<td>Gecko</td>
			<td>Win 2k+ / OSX.3+</td>
			<td class="center">1.9</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Camino 1.0</td>
			<td>Gecko</td>
			<td>OSX.2+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Camino 1.5</td>
			<td>Gecko</td>
			<td>OSX.3+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Netscape 7.2</td>
			<td>Gecko</td>
			<td>Win 95+ / Mac OS 8.6-9.2</td>
			<td class="center">1.7</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Netscape Browser 8</td>
			<td>Gecko</td>
			<td>Win 98SE+</td>
			<td class="center">1.7</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Netscape Navigator 9</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.2+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.0</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.1</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.1</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.2</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.2</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.3</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.3</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.4</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.4</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.5</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.5</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.6</td>
			<td>Gecko</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">1.6</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.7</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.1+</td>
			<td class="center">1.7</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Mozilla 1.8</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.1+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Seamonkey 1.1</td>
			<td>Gecko</td>
			<td>Win 98+ / OSX.2+</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Epiphany 2.20</td>
			<td>Gecko</td>
			<td>Gnome</td>
			<td class="center">1.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Safari 1.2</td>
			<td>Webkit</td>
			<td>OSX.3</td>
			<td class="center">125.5</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Safari 1.3</td>
			<td>Webkit</td>
			<td>OSX.3</td>
			<td class="center">312.8</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Safari 2.0</td>
			<td>Webkit</td>
			<td>OSX.4+</td>
			<td class="center">419.3</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Safari 3.0</td>
			<td>Webkit</td>
			<td>OSX.4+</td>
			<td class="center">522.1</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>OmniWeb 5.5</td>
			<td>Webkit</td>
			<td>OSX.4+</td>
			<td class="center">420</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>iPod Touch / iPhone</td>
			<td>Webkit</td>
			<td>iPod</td>
			<td class="center">420.1</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>S60</td>
			<td>Webkit</td>
			<td>S60</td>
			<td class="center">413</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 7.0</td>
			<td>Presto</td>
			<td>Win 95+ / OSX.1+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 7.5</td>
			<td>Presto</td>
			<td>Win 95+ / OSX.2+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 8.0</td>
			<td>Presto</td>
			<td>Win 95+ / OSX.2+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 8.5</td>
			<td>Presto</td>
			<td>Win 95+ / OSX.2+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 9.0</td>
			<td>Presto</td>
			<td>Win 95+ / OSX.3+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 9.2</td>
			<td>Presto</td>
			<td>Win 88+ / OSX.3+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera 9.5</td>
			<td>Presto</td>
			<td>Win 88+ / OSX.3+</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Opera for Wii</td>
			<td>Presto</td>
			<td>Wii</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Nokia N800</td>
			<td>Presto</td>
			<td>N800</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Nintendo DS browser</td>
			<td>Presto</td>
			<td>Nintendo DS</td>
			<td class="center">8.5</td>
			<td class="center">C/A</td>
		</tr>
		<tr class="gradeC">
			<td>Konqureror 3.1</td>
			<td>KHTML</td>
			<td>KDE 3.1</td>
			<td class="center">3.1</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeA">
			<td>Konqureror 3.3</td>
			<td>KHTML</td>
			<td>KDE 3.3</td>
			<td class="center">3.3</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeA">
			<td>Konqureror 3.5</td>
			<td>KHTML</td>
			<td>KDE 3.5</td>
			<td class="center">3.5</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeX">
			<td>Internet Explorer 4.5</td>
			<td>Tasman</td>
			<td>Mac OS 8-9</td>
			<td class="center">-</td>
			<td class="center">X</td>
		</tr>
		<tr class="gradeC">
			<td>Internet Explorer 5.1</td>
			<td>Tasman</td>
			<td>Mac OS 7.6-9</td>
			<td class="center">1</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeC">
			<td>Internet Explorer 5.2</td>
			<td>Tasman</td>
			<td>Mac OS 8-X</td>
			<td class="center">1</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeA">
			<td>NetFront 3.1</td>
			<td>Misc</td>
			<td>Embedded devices</td>
			<td class="center">-</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeA">
			<td>NetFront 3.4</td>
			<td>Misc</td>
			<td>Embedded devices</td>
			<td class="center">-</td>
			<td class="center">A</td>
		</tr>
		<tr class="gradeX">
			<td>Dillo 0.8</td>
			<td>Misc</td>
			<td>Embedded devices</td>
			<td class="center">-</td>
			<td class="center">X</td>
		</tr>
		<tr class="gradeX">
			<td>Links</td>
			<td>Misc</td>
			<td>Text only</td>
			<td class="center">-</td>
			<td class="center">X</td>
		</tr>
		<tr class="gradeX">
			<td>Lynx</td>
			<td>Misc</td>
			<td>Text only</td>
			<td class="center">-</td>
			<td class="center">X</td>
		</tr>
		<tr class="gradeC">
			<td>IE Mobile</td>
			<td>Misc</td>
			<td>Windows Mobile 6</td>
			<td class="center">-</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeC">
			<td>PSP browser</td>
			<td>Misc</td>
			<td>PSP</td>
			<td class="center">-</td>
			<td class="center">C</td>
		</tr>
		<tr class="gradeU">
			<td>All others</td>
			<td>Other browsers</td>
			<td>-</td>
			<td class="center">-</td>
			<td class="center">U</td>
		</tr>
	</tbody>
</table>
			</div>
			<div class="spacer"></div>
			
			
			<h1>Initialisation code</h1>
			<pre>$(document).ready( function () {
	var oTable = $('#example').dataTable( {
		"sScrollY": "300px",
		"sScrollX": "100%",
		"sScrollXInner": "150%",
		"bScrollCollapse": true,
		"bPaginate": false,
		"aaSortingFixed": [ [1, 'asc'] ],
		"aoColumnDefs": [
			{ "bVisible": false, "aTargets": [1] }
		]
	} );

	new FixedColumns( oTable, {
		"fnDrawCallback": function ( left, right ) {
			var oSettings = oTable.fnSettings();
			if ( oSettings.aiDisplay.length == 0 )
			{
				return;
			}

			var nGroup, nCell, iIndex, sGroup;
			var sLastGroup = "", iCorrector=0;
			var nTrs = $('#example tbody tr');
			var iColspan = nTrs[0].getElementsByTagName('td').length;

			for ( var i=0 ; i&lt;nTrs.length ; i++ )
			{
				iIndex = oSettings._iDisplayStart + i;
				sGroup = oSettings.aoData[ oSettings.aiDisplay[iIndex] ]._aData[1]			;
				
				if ( sGroup != sLastGroup )
				{
					/* Cell to insert into main table */
					nGroup = document.createElement( 'tr' );
					nCell = document.createElement( 'td' );
					nCell.colSpan = iColspan;
					nCell.className = "group";
					nCell.innerHTML = "&amp;nbsp;";
					nGroup.appendChild( nCell );
					nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );

					/* Cell to insert into the frozen columns */
					nGroup = document.createElement( 'tr' );
					nCell = document.createElement( 'td' );
					nCell.className = "group";
					nCell.innerHTML = sGroup;
					nGroup.appendChild( nCell );
					$(nGroup).insertBefore( $('tbody tr:eq('+(i+iCorrector)+')', left.body)[0] );

					iCorrector++;
					sLastGroup = sGroup;
				}
			}
		}
	} );
} );</pre>


			<h1>Documentation</h1>
			<ul>
				<li><a href="http://datatables.net/extras/fixedcolumns">Usage</a></li>
				<li><a href="http://datatables.net/docs/FixedColumns">API / parameters</a></li>
			</ul>

			<h1>Basic examples</h1>
			<ul>
				<li><a href="index.html">Basic demo of FixedColumns with zero initialisation</a></li>
				<li><a href="left_right_columns.html">Fix the left and right columns in place</a></li>
				<li><a href="index_column.html">Index column attached to side of the table</a></li>
				<li><a href="x_y_scrolling.html">Index column, but with Y scrolling and no pagination</a></li>
				<li><a href="two_columns.html">Two columns fixed in place</a></li>
				<li><a href="right_column.html">Fix the right column in place</a></li>
				<li><a href="css_size.html">Speeding up row height matching with CSS</a></li>
				<li><a href="themed.html">jQuery UI themed table with FixedColumns</a></li>
			</ul>
			
			<h1>Advanced examples</h1>
			<ul>
				<li><a href="rowspan.html">Using ROWSPAN with FixedColumns</a></li>
				<li><a href="server-side-processing.html">Server-side processing with FixedColumns</a></li>
				<li><a href="col_filter.html">Individual column filtering</a></li>
				<li><a href="scale_fixed.html">Setting the fixed column width and resizing the table</a></li>
				<li><a href="scale_relative.html">Setting the fixed column width with relative sizing</a></li>
				<li><a href="row_grouping_height.html">Row grouping by grouping like rows in the fixed column</a></li>
				<li><a href="row_grouping.html">Row grouping by inserting a grouping row</a></li>
			<ul>
			
			
			<div id="footer" style="text-align:center;">
				<span style="font-size:10px;">
					FixedColumns and DataTables &copy; Allan Jardine 2011.<br>
				</span>
			</div>
		</div>
	</body>
</html>