Regarding reloading of dataTable

Regarding reloading of dataTable

KedarKedar Posts: 2Questions: 0Answers: 0
edited October 2009 in Bug reports
I want to reload dataTable on change of value of drop down tag

My Code in JS is
var oTable;

$(function(){
oTable=$("#MyTable").dataTable(
{
bProcessing: true,
bServerSide: true,
sAjaxSource: ""+$('#contextPath').text()+"/dataServlet",
fnServerData: function ( sSource, aoData, fnCallback ) {
alert('Reached onSubmit dataTable function');
/* Add some extra data to the sender */

aoData.push( { "name": "my_name", "value": "my_value" } );
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json);
} );
}
}
);
});

function reloaddataTable()
{
oTable.fnReloadAjax();
}

This is my code in JS. It is working fine but the datatable is not getting reloaded on change of option of select box.

reloaddataTable() is being called from another function . I want that function mentioned in "fnServerData" should be called on reload and the request should go to same url.

Any one can plz tell me what should I do.

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Hi Kedar,

    You are using server-side processing here - therefore if you want to reload the data for the current page from the server, all you need to do is call oTable.fnDraw(). This will cause DataTables to request the current page from the server again.

    Regards,
    Allan
This discussion has been closed.