Programatically loading AJAX data

Programatically loading AJAX data

thelinuxlichthelinuxlich Posts: 4Questions: 0Answers: 0
edited September 2010 in General
I have a dataTable with ajaxSource but I want it to load data only when I click a link. How can I disable data loading on initialization?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can use the fnServerData function to override the standard action of DataTables ( http://datatables.net/usage/callbacks#fnServerData ). You could just not do a call on the first call. An alternative is to use fnAddData and fnClearTable and a local javascript array to load data that you have retrieved.

    Allan
  • jeezusjeezus Posts: 2Questions: 0Answers: 0
    Maybe you can just enclose the dataTable drawing in another function an execute that function on buttonclick???

    function foo() {
    qtable = $('mytable').dataTables();
    }

    $('button').click(function() {
    foo();
    }
    ...

    Just an idea... :)
This discussion has been closed.