I just posted about Monkey Patching, a technique used in chapter 7 of my book PeopleTools Tips and Techniques to set the default search page operator on advanced search pages (Note: only 8.50 and later required Monkey Patching). As I was looking over the "Changing Search Operators" section of chapter 7, I noticed the code was missing a few lines (pages 293 - 296). Here is my revision:
Hi Jim, thanks for so much spectacular content! I wonder if you have a suggestion for approaching this requirement. I'd like to make PeopleSoft search pages default to the stylesheet of the first page in the component they are hanging from - of course in the least-invasive way possible.
Thanks in advance for any help you can give.
Making a blocking ajax call on load will have an impact on performance. If you don't mind the screen flicker of loading up a new stylesheet after the page is loaded, then you can go with non blocking and import the stylesheet using the technique mentioned in my Importing Custom Stylesheets post.
Thanks for the detailed response, Jim! We will buy your book and try it out, and let you know how it goes.
@Paul, Sorry, I didn't mean to push the book so hard in my response. I just assumed everyone already had it ;). And, I wanted to get you an answer rather than have you wait for me to write up a full response.
The book is available through Safari Books Online, and several other online media, so if you already have a subscription somewhere, then you should have access.
@Jim Oh, no problem there at all - I've been meaning to buy it anyway, and if it saves me an hour of work on this issue I'll have already paid for it. You provided plenty of free advice in your reply - knowing the destination I need to reach, I'm happy to buy the ticket!-)
Warning: A call to document.write() from an asynchronously-loaded external script was ignored.
Source File: [URL of currently-displayed PeopleSoft content]
Despite this warning, everything seems to work relatively well. Any idea how I can debug this?
@Leandro, that may be caused by a difference between PT 8.49 and 8.50+. 8.49 performed full page refreshes when loading pages. 8.50+ systems use Ajax. document.write called after $(document).ready will overwrite the entire page. That is why you receive the warning. I will make note of this for the next version of the book.
In the code, you will notice that the import script function uses document.write until a certain point, and then changes the definition of the import script function to one that creates a script node. Given 8.50+'s Ajax design, document.write should no longer be the default. Instead, it should be replaced with a check to see if the page is loaded. If it is, then use the script node variety. Otherwise, use document.write.
I am surprised it is working with document.write.
Jim, can this be done in a PeopleCode event just before I call a DoModalComponent function?
I want to change the operator to 'in' so I can pass a list of possible values to search for.
Post a Comment