Adding events to pagination changes?

Adding events to pagination changes?

streetlightstreetlight Posts: 26Questions: 0Answers: 0
edited September 2012 in General
Hey all,

Perhaps I'm not understanding everything necessary, but I've been trying for hours (maybe days) to have certain functions run when the page is changed (specifically, reloading and other custom events that run normally on page one). I can't seem to figure it out. As of now, I'm targeting the events using the classes and ID's on the page number changes, but this has only been leading to more bugs and it's driving me crazy!

Someone out there, please help! I feel like there is a simple answer I just can't find!!!!!

Replies

  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    Use fnDrawCallback
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Or the page event: http://datatables.net/docs/DataTables/1.9.4/#page

    Allan
  • streetlightstreetlight Posts: 26Questions: 0Answers: 0
    This is great! Thank you Robert and Allan.

    Allan, would you be able to post an example of the page event being used? Do I put it in the initalization, or target it after the page has loaded? Sorry for the beginner-esque question!

    I can use fnDrawCallback for most of what I need, but in one of my functions I'm have to use fnGetNodes, which don't exist yet during the fnDrawCallback (at least to my knowledge).

    Thank you again!
  • streetlightstreetlight Posts: 26Questions: 0Answers: 0
    Also, to be clear, I'm need it the Nodes to load, because what i'm searching for is something that is altered by the user ( a seleced state), and I'm trying to remove that state (among other things) on each page event
  • streetlightstreetlight Posts: 26Questions: 0Answers: 0
    And in addition, if anyone else can provide an example that would be great too! Didn't mean to seem inclusive!
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    [code]
    $('#myTable').on('page', function () {...} );
    [/code]

    should be all that is needed.

    Allan
  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    Since you're onjly concerned with the visual appearance of only the rows that get drawn, you could use mRender.
  • streetlightstreetlight Posts: 26Questions: 0Answers: 0
    Thank you guys! Allan, your answer worked perfectly. When I used that (in accordance with fnDrawCallback), my problems were solved. I can't thank you enough for helping me out! :)
This discussion has been closed.