From 2b0a321dd2b9c91f1d94bdd8d6e697546b68add0 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 29 Apr 2013 07:50:43 +0100 Subject: [PATCH] New: rows().remove() API method - Remove (delete) selected rows from the table. - This effectively replaces the fnDeleteRow API method of the old API. --- media/src/api/api.rows.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/media/src/api/api.rows.js b/media/src/api/api.rows.js index 2f8f1575..6a281c44 100644 --- a/media/src/api/api.rows.js +++ b/media/src/api/api.rows.js @@ -57,5 +57,39 @@ _api.register( 'rows().data()', function ( data ) { } ); +_api.register( 'rows().remove()', function () { + var that = this; + + // Needs either a corrector to correct for deleted row indexes, or + // need to order and reverse so indexing is maintained for the row + // indexes. Damn + // @todo + return this.iterator( true, 'row', function ( settings, row, thatIdx ) { + var data = settings.aoData; + + data.splice( row, 1 ); + + // Update the _DT_RowIndex parameter on all rows in the table + for ( var i=0, ien=data.length ; i