diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 22baab9d..f767eac5 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -4753,13 +4753,11 @@ * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { - * var that = this; - * oTable.fnOpen( this, "Temporary row opened", "info_row" ); - * - * // Then when the info row is clicked upon - close it - * $('#example .info_row').click( function () { - * oTable.fnClose(that); - * } ); + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } * } ); * * oTable = $('#example').dataTable(); @@ -5209,6 +5207,42 @@ }; + /** + * Check to see if a row is 'open' or not. + * @param {node} nTr the table row to check + * @returns {boolean} true if the row is currently open, false otherwise + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable = $('#example').dataTable(); + * } ); + */ + this.fnIsOpen = function( nTr ) + { + var oSettings = _fnSettingsFromNode( this[_oExt.iApiIndex] ); + + for ( var i=0 ; i