Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6739521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:29:56+00:00 2026-05-26T11:29:56+00:00

I am using Datatables and have a button on the page that refreshes the

  • 0

I am using Datatables and have a button on the page that refreshes the table using AJAX. To be clear the table isn’t using an ajax source of data, we are just using ajax to refresh it only when needed. Ajax is refreshing the div which the table is wrapped in. I know i’m losing my pagination buttons and filtering capability because the table needs to be redrawn but i’m not sure how to add this into the table initialization code.

Datatables code

var oTable6;
$(document).ready(function() {
    oTable6 = $('#rankings').dataTable( {
        "sDom":'t<"bottom"filp><"clear">',
        "bAutoWidth": false,
        "sPaginationType": "full_numbers",
        "aoColumns": [ 
            { "bSortable": false, "sWidth": "10px" },
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null
        ]

    });
});

The ajax code is this

$("#ajaxchange").click(function(){
    var campaign_id = $("#campaigns_id").val();
    var fromDate = $("#from").val();
    var toDate = $("#to").val();

    var url = 'http://domain.com/account/campaign/ajaxrefreshgrid?format=html';
    $.post(url, { campaignId: campaign_id, fromdate: fromDate, todate: toDate},
        function( data ) { 
            $("#ajaxresponse").html(data);
        });
});

I tried this but it didn’t work

"fnDrawCallback": function() {
    function( data ) { 
        $("#ajaxresponse").html(data);
    };
},
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:29:57+00:00Added an answer on May 26, 2026 at 11:29 am

    It looks as if you could use the API functions to

    • clear the table ( fnClearTable )
    • add new data to the table ( fnAddData)
    • redraw the table ( fnDraw )

    http://datatables.net/api

    UPDATE

    I guess you’re using the DOM Data Source (for server-side processing) to generate your table. I didn’t really get that at first, so my previous answer won’t work for that.

    To get it to work without rewriting your server side code:

    What you’ll need to do is totally remove the old table (in the dom) and replace it with the ajax result content, then reinitialize the datatable:

    // in your $.post callback:
    
    function (data) {
    
        // remove the old table
        $("#ajaxresponse").children().remove();
    
        // replace with the new table
        $("#ajaxresponse").html(data);
    
        // reinitialize the datatable
        $('#rankings').dataTable( {
        "sDom":'t<"bottom"filp><"clear">',
        "bAutoWidth": false,
        "sPaginationType": "full_numbers",
            "aoColumns": [ 
            { "bSortable": false, "sWidth": "10px" },
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null
            ]
    
        } 
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using DataTables ( datatables.net ) to display data from an Ajax source and
I have a DataTable that I manually created and loaded with data using C#.
I have created a user control that contains a button. I am using this
I'm using datatables plugin for jquery to show my data on the page. I
New to Rails and even newer to Ajax. I have a page that displays
I'm using tomahawk's datascroller to page though data in a datatable. I have two
I have started using the DataTables plugin (v1.6.2) for jQuery (v1.4.2), and I would
I heard that microsoft does not recommend using DataSets and DataTables in new projects.
I am using a Jquery's datatable. I have a table with id = affectedRegion.
I'm using the datatables JQuery plugin. I use it with AJAX and pagination (server-side).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.