1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-17 15:54:14 +01:00

Examples - fix: Single row selection could have a JS error if deleting a row when no rows selected

This commit is contained in:
Allan Jardine 2012-03-11 17:56:55 +00:00
parent 918a065f21
commit d7912b09a0

View File

@ -29,7 +29,9 @@
/* Add a click handler for the delete row */
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
oTable.fnDeleteRow( anSelected[0] );
if ( anSelected.length !== 0 ) {
oTable.fnDeleteRow( anSelected[0] );
}
} );
/* Init the table */
@ -503,7 +505,9 @@ $(document).ready(function() {
/* Add a click handler for the delete row */
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
oTable.fnDeleteRow( anSelected[0] );
if ( anSelected.length !== 0 ) {
oTable.fnDeleteRow( anSelected[0] );
}
} );
/* Init the table */