Quantcast
Viewing all articles
Browse latest Browse all 82138

fnDeleteRow matching rules

I made a mistake in some code and it gave some strange behaviour.

This is the code:
	var selectedrows = document.querySelectorAll('.row_selected');
	console.log (selectedrows);
	console.log ( selectedrows.length + " rows to delete");
	// cycle through
	for ( var i = 0; i< selectedrows.length; i++) {
		// delete it
		oTable.fnDeleteRow( selectedrows[0], null, false );
	}
	oTable.fnDraw();

The mistake was that I had [0] in the loop and not [i]. I would expect it to delete the first row and then fail.
it didn't! I deletes multiple rows and not the ones required!
Why?
How does fnDeleteRow use a tr element to match to internal data structures?

Viewing all articles
Browse latest Browse all 82138

Trending Articles