We have our search result Web part configured to show only the different list items, based on the query. For every list, we have InfoPath form associated. Around 20-25 items are the result of the search result Web part. We have updated our display template to open every link in the new tab in the same Browser Window.
Also, a customer wants to take the printout of all these forms. Thus, to take the printout, he needs to click each and every link from the search result. Go to every tab and print the form.
Thus, this is a little bit of a tedious process. If there are 25 links shown in the search result, they need to click 25 times for opening each link in the new tab and then 25 more clicks to give the print command by going to each and every form. This approach is not liked by the customers and they were asking to minimize the clicks required to print all the forms.
Customer Requirement
Customer wants to minimize the efforts required to print all the links (forms) shown in search result Web part.
Our Approach/Solution
I saw such a kind of requirement for the first time, Googled a lot and put a lot of time into thinking about how we can achieve this. Hence, we broke this requirement in the two sub requirements, which are:
- Printing all the tabs together.
- Opening all the links in tabs.
Printing all the tabs together
After a lot of Googling, I found one Add-on to FireFox Browser, which prints all the tabs together.
Add-on name – Universal Print - https://addons.mozilla.org/en-US/firefox/addon/universal-print/
This is a very good Add-on, which provides the features like:
- Print current tab
- Print all the tabs
- Print selected tabs
These features are very useful and our work is half done. We have added this Add-on in FireFox Browser. Thus, after opening all the tabs, we need to right click on any tabs and the following options come, as shown in the following figure:
The only limitation to this approach is our customer, who needs to use only FireFox Browser. Since at the customer side, only 4-5 users are taking print outs, so it's no problem to the customer to use FireFox Browser.
This is only half done. Customer still needs to open 20-25 clicks to open all the links in the tabs and then one more click for the printing.
Opening all the links together/at a time in tabs
Opening all the links at one click is not a big job, since we may have JavaScript, which will open all the links in the tabs. Following is the approach, we used:
- Added content editor Web part on Search result page.
- Write JavaScript to open all the links from our search result Web part in the Browser tabs.
JavaScript snippet
- <script type="text/JavaScript">
- function openlinks()
- {
-
- var links = document.links;
- for(var i =0; i<links.length; i++) {
-
- if(links[i].toString().indexOf('Source')>=0){
- window.open(links[i]);
- }
- }
- }
- </script><input type="button" onclick="openlinks();" value="OpenAllLinks"/>
Finally, we managed to print all the links in the two clicks.