<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="html" order="6">

<css lib="datatables" />
<js lib="jquery" />
<js lib="datatables" />

<title>Row selection (multiple rows)</title>
<js><![CDATA[

$(document).ready(function() {
	var table = $('#example').DataTable();

	$('#example tbody').on( 'click', 'tr', function () {
		$(this).toggleClass('selected');
	} );

	$('#button').click( function () {
		alert( table.rows('.selected').data().length +' row(s) selected' );
	} );
} );

]]></js>

<info><![CDATA[

It can be useful to provide the user with the option to select rows in a DataTable. This can be done by using a click event to add / remove a class on the table rows. The `dt-api rows().data()` method can then be used to get the data for the selected rows. In this case it is simply counting the number of selected rows, but much more complex interactions can easily be developed.

If you are looking for a more complete and easier to use row selection option, the [Select extension](https://datatables.net/extras/select) provides an API that is fully integrated with DataTables for selecting rows and acting upon that secletion.

]]></info>

<demo-html>
	<button id="button">Row count</button>
</demo-html>

</dt-example>
