Document Preview Events
AnsweredI am having trouble finding an exposed event in the Document Preview that would cue my code that the document has been entirely rendered - i.e., all the pages or at least the first page has rendered to the DOM so further work can be done in the DOM. The 'load' event seems to fire quite early - sometime after the viewer container is rendered but before the contained document is rendered. The 'pagefocus' event seems to work as expected, except on the first page. When a document renders, it always focuses in on whatever page was previously viewed, but 'pagefocus' doesn't catch this event. The 'pagerendered' event doesn't seem to get kicked off at all. So I actually need to write a nasty poll to wait for the document to be loaded in the previewer? Currently, if I use the 'load' event, my code doesn't find any DOM elements for the document and does nothing.
-
Hey - thanks for the report. We had a documentation error; the event you're looking for is `pagerender` not `pagerendered`. I've updated the documentation to reflect this fix.
Here's an example of the event in action: https://codepen.io/box-platform/pen/owVMVy
-
I just thought I'd put in a quick reminder that those docs are still incorrect -- at least, this one is:
https://developer.box.com/docs/file-types-events
I'm glad I found this on the forum!
-
Thanks for the heads up! *Now* it should be good 🙂 Double checked it this time! You're a rockstar!
https://developer.box.com/docs/file-types-events
Please sign in to leave a comment.
Comments
5 comments