DataTables Events

DataTables Events

gavin4pgavin4p Posts: 3Questions: 0Answers: 0
edited March 2011 in General
Hi does datatables fire any events, for example when the visible result set changes via a user search or next page clicked?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Hi gavin4p,

    At the moment no - DataTables uses callbacks for informing of status changes in the current model. This is something that I'm actively considering for future versions though, so all input welcome! I doubt I'll get it into 1.8, or if I do it's not going to be as complete as I would perhaps like - but I'll be seeing what I can do and what is suitable.

    Regards,
    Allan
  • gavin4pgavin4p Posts: 3Questions: 0Answers: 0
    Hi Allan

    Thanks for your response, which callback should I use and how should I set it? I need a callback for every time the table has finished drawing, be it after a page change, sort change or search filter. I have tried the following:

    $('#test').dataTable({
    'sPaginationType': 'full_numbers',
    'bLengthChange' : false,
    'aoDrawCallback' : [{
    "fn" : resizeModule,
    "sName": "resizeModule"
    }]
    });
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    http://datatables.net/usage/callbacks#fnDrawCallback :-)

    aoDrawCallback is an internal variable to which fnDrawCallback, as passed in, will be added.

    Allan
  • gavin4pgavin4p Posts: 3Questions: 0Answers: 0
    Thanks, that worked great.
This discussion has been closed.