oSettings is null after fnReloadAjax (server side)

oSettings is null after fnReloadAjax (server side)

javieraoterojavieraotero Posts: 2Questions: 0Answers: 0
edited September 2012 in Plug-ins
Hi all!

I have a problem when i try to reload data to the datatable calling the function fnReloadAjax. I'm using 1.9 version.

The code of the datatable:

[code]
$(document).ready(function() {
var $table = $('#table-id2');
var dt = $table.dataTable({
"bProcessing": true,
"oLanguage": { "sUrl": "/Scripts/DataTables-1.9.2/media/js/es.datatables.txt" },
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bStateSave": false,
"bServerSide": true,
"bFilter": 'true',
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Todos"]],
"sAjaxSource": "/Backend/Categorias/getCategorias",
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
});
[/code]

And when call fnReloadAjax:

[code]
$(document).ready(function () {
$("#guardar").click(function () {
var form = $('#myform');
form.validate();
if (form.valid()) {
$("#ProgressDialog").dialog("open");
$.ajax({
type: "POST",
url: form.attr("action"),
data: form.serialize(),
success: function (data) {
if (data[0]) {
$("#SuccessContainer").html(data[1]);
$("#SuccessDialog").dialog("open");
} else {
$("#FormContainer").html(data[1]);
$.validator.unobtrusive.parse("form");
}
},
error: function (jqXhr, textStatus, errorThrown) {
alert("Error el procesar ajax'" + jqXhr.status + "' (textStatus: '" + textStatus + "', errorThrown: '" + errorThrown + "')");
},
complete: function () {
$("#ProgressDialog").dialog("close");
agregarAlertaSatisfactoria("#alertas");
form[0].reset();
$("#table-id").dataTable().fnReloadAjax();
}
});
}
});
});
[/code]

Thank you for your help!

Replies

This discussion has been closed.