Hi All,

I am trying to create a datatable using the jQuery plugin from www.datatables.net. I have a paginated table with column filters and column sorting that get's its data from the server side (MySql db). So far, so good.

I already posted this question on the discussion list of the plugin's site, but I still haven't managed to figure out what's going wrong.

The problem is this:
I have a button in each row that I use to delete the data of that row from the database. To also remove the row from the table that is onscreen, I need to do a redraw of the table, so that the datatables plugin get's the updated resultset from the database and fills the table with the new data and repaginates, etc. I try to do this redraw using the function:
fnDraw() on the datatable variable oTable (see code below to see how oTable is defined).
When I do this, the datatables plugin script returns an error stating that "oSettings is null". I don't know why I get this and I can't seem to get rid of it. Any ideas?

Below is my code.

The piece of javascript that initiates the datatable:
Code JavaScript:
var oTable = jQuery('#batchsearchcontainer').dataTable( {
				"bProcessing": true,
				"bServerSide": true,
				"bStateSave": true,
				"sPaginationType": "full_numbers",
				"iDisplayLength": 25,
				"sAjaxSource": "/geoviewer/includes/dataTables/server_processing.php",
				"sDom": '<"top"<"toolbar"lip<"clear">><"clear">>rt',
				"oLanguage": {
					"oPaginate": {
						"sFirst": "Eerste",
						"sLast": "Laatste",
						"sNext": "Volgende",
						"sPrevious": "Vorige",
					},
					"sInfo": "Resultaten _START_ - _END_ van _TOTAL_",
					"sInfoEmpty": "Geen gegevens gevonden",
					"sInfoFiltered": "in set van _MAX_ records",
					"sLengthMenu": "Toon _MENU_ resultaten per pagina",
					"sProcessing": "Verwerken...",
					"sSearch": "Zoeken",
					"sZeroRecords": "Geen gegevens gevonden"
				}
			});

The code for deleting the record and redrawing the table:
Code JavaScript:
jQuery("#batchsearchform .subbatch_verwijderen").live("click",function(){
  var vDeelPartijID = Right(jQuery(this).closest("tr").find("td:nth-child(4) div").attr("id"), jQuery(this).closest("tr").find("td:nth-child(4) div").attr("id").length - 8);
  var vVrachtboncode = jQuery(this).closest("tr").find("td:nth-child(5) div").text();
  if (confirm("Are you sure you want to delete record "+vVrachtboncode+"?")) { 
    var vDelete = "True";
  }
  jQuery.post("includes/del_deelpartij.php", { Delete: vDelete, DeelPartijID: vDeelPartijID }, function(data) {
    if (data) {
		oTable.fnDraw();
		alert("Record "+vVrachtboncode+" has been removed.");
	}
  });
});

I also tried to replace the line "oTable.fnDraw();" with:
Code JavaScript:
var oSettings = oTable.fnSettings();
oTable.oApi._fnDraw( oSettings );

This gives the same error ("oSettings is null"), but on a different line in the plugin script.

I hope someone here may have an idea about why I run into this error. I would appreciate any help greatly!

If any more information is needed, please let me know. I'll be happy to give it.

Best regards,
Martijn.
p.s. "Right(string, length)" is a custom function similar to the Visual Basic Right function (http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx). I use it here to take the required database ID from the right side of the HTML #ID-string.