Something like a fnPostDrawCallback possible to be called after rendering is complete?

Something like a fnPostDrawCallback possible to be called after rendering is complete?

drubin_ddrubin_d Posts: 1Questions: 0Answers: 0
edited October 2012 in General
I'm hoping to keep the table hidden until it has completed rendering to avoid the user seeing any flashing of elements as I add columns dynamically. The plan is to 'show' the table once all is ready. Is there some way to do this? I've tried 'fnInitComplete' and 'fnDrawCallback' and they both seem to occur too early. Fanks!

- Daniel

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    fnDrawCallback is the callback which corrects when the draw is complete. In what way does it occur to early? DataTables shouldn't be doing anything with the DOM after that function is called.

    Allan
  • stormbladestormblade Posts: 10Questions: 0Answers: 0
    edited February 2013
    I'm having a similar issue. It seems to be firing fine but earlier than I want it too. I was able to see this by putting an alert in and the alert pops up very quickly and I can see the table adjusting. Perhaps applying CSS? Or something. But this really messes me up because I'm adding overlays on certain rows and I need to grab the dimensions after the table is completely rendered.

    It seems to work fine for the initial draw but when I refresh the page or go to the next page it delays.

    Also just to verify this was a timing thing I wrapped my code in a setInterval and waited 2 seconds. Worked perfectly since this gave the table plenty of time to fully render and apply any formatting and what have you.

    Any ideas? Oh and I'm running 1.8.2
  • stormbladestormblade Posts: 10Questions: 0Answers: 0
    edited February 2013
    A co-worker just solved my issue. He'd written the code that generated the images that were to be placed in the table. He didn't put a width or height on the images and instead used CSS. The images were not loaded initially and so the table was drawn, the event and callback fired and then the images loaded changing the height of the rows.

    Putting a width and height on the images (Like I always do) solved this issue. And I wagged my finger at him for not doing that.
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Heh - good to hear you got it sorted out :-)

    Allan
This discussion has been closed.