From f4ff79bfba306db5345da5399b1c300acefc4869 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 14 Dec 2011 17:59:53 +0000 Subject: [PATCH] Update the select row examples to use the $ API method --- examples/api/select_row.html | 26 ++------------ examples/api/select_single_row.html | 54 ++++++++++------------------- 2 files changed, 22 insertions(+), 58 deletions(-) diff --git a/examples/api/select_row.html b/examples/api/select_row.html index f1b2e7b1..9dd2bf6f 100644 --- a/examples/api/select_row.html +++ b/examples/api/select_row.html @@ -31,17 +31,7 @@ */ function fnGetSelected( oTableLocal ) { - var aReturn = new Array(); - var aTrs = oTableLocal.fnGetNodes(); - - for ( var i=0 ; i @@ -52,7 +42,7 @@

Preamble

-

It can be quite useful at times to provide the user with the option to select rows in a DataTable. This can be done using the API functions that DataTables provides. The example below uses the fnRowCallback() function to add a 'click' listener to each row, which will highlight the required row when selected. The indexes of the selected rows are then provided through the custom function fnGetSelected() for later processing.

+

It can be quite useful at times to provide the user with the option to select rows in a DataTable. This can be done by simply using a click event to add/remove a class on the table rows. The the selected rows are then provided through the custom function fnGetSelected() for later processing.

Live example

@@ -505,17 +495,7 @@ */ function fnGetSelected( oTableLocal ) { - var aReturn = new Array(); - var aTrs = oTableLocal.fnGetNodes(); - - for ( var i=0 ; i<aTrs.length ; i++ ) - { - if ( $(aTrs[i]).hasClass('row_selected') ) - { - aReturn.push( aTrs[i] ); - } - } - return aReturn; + return oTableLocal.$('tr.row_selected'); }