requesting help for fnReloadAjax

requesting help for fnReloadAjax

franksterfrankster Posts: 2Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Hi,

I'm trying to get fnReloadAjax to work, and I've googled and tried things for hours but was unsuccessful.
I'm using datatables 1.8.1 and jQuery 1.6.2.

Here's my code:
[code]
var oTable;
$(document).ready(function(){
oTable = $('#notificationSummary').dataTable( {
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bAutoWidth": false,
"bProcessing": true,
"bJQueryUI": true,
"bDestroy": true,
"sPaginationType": "full_numbers",
"bDeferRender": true,
"iDisplayLength": 12,
"sAjaxSource":$('#contextPath').text()+"/srd/notificationList.action",
"aoColumns": [
{ "sTitle": "Type" },
{ "sTitle": "From" },
{ "sTitle": "Repair #" },
{ "sTitle": "Repair Status" },
{ "sTitle": "Date" }
]
});

......

$('#newQuotesTable').click(function() {
//notificationSummaryTable.fnDestroy();
alert($('#contextPath').text()+'/quote/quoteList.action');

//notificationSummaryTable.fnReloadAjax($('#contextPath').text()+'/quote/quoteList.action');
//notificationSummaryTable.fnReloadAjax('/SmartRepairDashboard/quote/quoteList.action');
oTable.fnReloadAjax();
alert('hey');
});
});


[/code]

What I ultimately want to do is to send in a different ajax source but even fnReloadAjax without any parameter does not work for me.
So I tried to find fnReloadAjax from the datatables js file but I couldn't find it either.
I get the first alert but do not get the 2nd alert. I tried changing oTable.fnReloadAjax() to oTable1.fnReloadAjax() or oTable.fnReloadAjax1() to see if it throws an error when I use wrong variable name or function name but it didn't give me anything either.

Could anyone help me with this issue?

Thanks,

Frank

Replies

  • franksterfrankster Posts: 2Questions: 0Answers: 0
    It seems like the jquery.dataTables.js from "DataTables-1.8.1\media\js" from the downloaded file has other functions that I checked but is just missing fnReloadAjax.
    Is there a different file that I need to download that includes fnReloadAjax?
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    yes, fnReloadAjax is a plug-in API function

    include this code to add the function to your instance
    [code]
    $.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
    {
    if ( typeof sNewSource != 'undefined' && sNewSource != null )
    {
    oSettings.sAjaxSource = sNewSource;
    }
    this.oApi._fnProcessingDisplay( oSettings, true );
    var that = this;
    var iStart = oSettings._iDisplayStart;

    oSettings.fnServerData( oSettings.sAjaxSource, [], function(json) {
    /* Clear the old information from the table */
    that.oApi._fnClearTable( oSettings );

    /* Got the data - add it to the table */
    for ( var i=0 ; i
This discussion has been closed.