Focal Point
[SOLVED] Adding a Print Button to a Page

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3437066296

February 20, 2020, 05:10 PM
Delana Pellerin
[SOLVED] Adding a Print Button to a Page
Is there a way to add a Print button to a container's toolbar options in Page Designer?

This message has been edited. Last edited by: FP Mod Chuck,


Application Edition
SQL Server
February 21, 2020, 11:17 AM
BabakNYC
Assuming you're on 8.2xx, yes, you can use JS and CSS to add functions like print, email et cetera. I don't have sample code but someone out there might have it.

There's helpful doc here:
..\config\web_resource\doc\automation\index.html

This message has been edited. Last edited by: BabakNYC,


WebFOCUS 8206, Unix, Windows
February 21, 2020, 05:22 PM
Doug
Try adding this for starters:
<input type="button" value="Print this page" onClick="window.print()">

February 24, 2020, 05:40 PM
vaayu
This might be an overkill but, here's what I did for my page, you add a class (custom1) to a panel (myPanel) and reference the class in JS as shown below and add icons using font awesome icons (fa fa-exl) you can look up for other icons if you like, and finally you add an event listener.
 
window.addEventListener("iba_pageloading", function (e){
    var page = e.data;
    var myPanel = document.querySelector(".custom1").ibaObject;
    var ibsite = myPanel.addButton({"glyphClasses": "fa fa-question", "class": "ibButton", "tooltip": "Help using this application"}, ".pd-container-title-button-resize", true);
    var btnExl = myPanel.addButton({"glyphClasses": "fa fa-file-excel-o", "class": "ibButton", "tooltip": "Excel Dowload"}, ".pd-container-title-button-resize", true);
    var btnPDF  = myPanel.addButton({"glyphClasses": "fa fa-file-pdf-o", "class": "ibButton", "tooltip": "PDF Download"}, ".pd-container-title-button-resize", true);
    var btnPrint  = atmPanel.addButton({"glyphClasses": "fa fa-print", "class": "ibButton", "tooltip": "Print"}, ".pd-container-title-button-resize", true);
    ibsite.addEventListener("click", function(){
        window.open("http://www.ibi.com");
    });
    btnPrint.addEventListener("click", function(){
        window.Print();
    });
    

    page.element().addEventListener("iba_beforecontentload", function (e){
        var loadInfo = e.data;
        var path = loadInfo.path; // The path to the content being described
        var defaultValues = loadInfo.defaultValues; // If default values are used to run the content
        // e.preventDefault() will stop the page from retrieving the content
        
        // use a try/catch block, to avoid errors
        try {
            // sortvaldd is the class name of my dropdown list
            var zipcode = document.querySelector(".zip").children[0].children[1].children[0];
            // tabcont1 is the class name of my dropdown 
            var zip = zipcode.value;
            var url = '../ibi_apps/wfirs/ibfs/WFC/Repository/COE/USB_Locations/USB_Branch_Report.fex'  ;
            url = url + '?ZIPCODE=' + zip ;
            exl.addEventListener("click", function(){
            url = url + '&FMT=XLSX' ;
            window.open(url) ;
            });
            atmPDF.addEventListener("click", function(){
            var r = Math.random();
            urlPDF = '../ibi_apps/wfirs/ibfs/WFC/Repository/COE/USB_Locations/USB_ATM_Report.fex' ;
            urlPDF = urlPDF + '&FMT=PDF' + '&r=' + r;
            window.open(urlPDF) ;
            });
            
        }
        catch(err) {
          // do nothing
        }
    });
});
 



-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
April 09, 2020, 10:29 AM
atul
i want to go back to teast 1 fex how can be this is possible
-DEFAULT &HEADING1 = 'TEST 1' ;
-SET &A = IF &HEADING1 EQ 'TEST 1' THEN '' ELSE '-*' ;
TABLE FILE CAR1
SUM
SALES
BY COUNTRY
BY CAR
&A BY MODEL
HEADING
" &HEADING1"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=HEADING,
FOCEXEC=IBFS:/WFC/Repository/projecttraining/clickingoutputs_heading.fex( \
HEADING1='TEST 2' \
),
TARGET='_self',
$
ENDSTYLE
END

any idea ?


atul
April 09, 2020, 11:10 AM
MartinY
Not 100% sure to understand your request but once you drilled to the child report (TEST 2), since you open it in same window as TEST 1 (TARGET='_self'), just press the backspace key on your keyboard or the back arrow on the browser


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 18, 2020, 12:40 PM
Doug
How about this?
<form> <input type="button" value="Return to previous page" onClick="javascript:history.go(-1)" /> </form>
With or without the form tags.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
April 22, 2020, 12:13 PM
vaayu
I believe this was for the new "WebFOCUS Page Designer" Panels


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************