Switch to Attached Documents Page

A while back, when I worked with HR.Net version 3, I came up with a bunch of random JavaScript hacks.
Now I’m working with version 4. JavaScript API has been changed and some of my tricks do not work in the new version. One of the things that was failing was switching to Attached Documents Page.

Today I had a pretty long but productive session in Chrome JavaScript debugger (did you know you can run HR.Net in Chrome??) and came up with a new script for Attached Documents:

$(window).load(function(){
	HRnet.Form.ScreenActions.ShowAttachedDocuments()
});

That is slightly neater than the old version, where I did not know about jquery $(document).ready() function and how to use it, so had to wrap the call to the function inside of a timer.
Now, here I can’t use $(document).ready() because somewhere else in Visual’s scripts there is document.ready function with page window resize that will not get triggered if I call ShowAttachedDocuments() inside of it as well. But $(window).load() is fired after all $(document).ready() are executed, so the window does get resized properly and we get to go to the page we want – attached documents.

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *