Focal Point
[SOLVED] Button addEventListener

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

December 18, 2019, 10:27 AM
vaayu
[SOLVED] Button addEventListener
I'm trying to add custom buttons to the panel and it works if I open any URLs or reports but, I'd like to pass the parms along with it, for eg., EXL Download for the same report with prms selected. I tried with &PARM=&PARM but no luck

   window.addEventListener("iba_pageloading", function (e){
    var panel = document.querySelector(".custom1").ibaObject;
    var ibsite = panel.addButton({"glyphClasses": "fa fa-question", "class": "ibButton", "tooltip": "Visit IB Site"}, ".pd-container-title-button-resize", true);
    var exl = panel.addButton({"glyphClasses": "fa fa-file-excel-o", "class": "ibButton", "tooltip": "Excel Dowload"}, ".pd-container-title-button-resize", true);
    ibsite.addEventListener("click", function(){
        window.open("http://www.ibi.com");
    });
    exl.addEventListener("click", function(){
        window.open='./wfirs/ibfs/WFC/Repository/COE/USB_Locations/USB_Branch_Report.fex';
    });
});

I think its cool to be able to add any button with fontawesome icons but need to be able to run report with parms on the page.

Thanks!
-P

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


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 18, 2019, 01:28 PM
Waz
Is this a composer page ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 18, 2019, 02:04 PM
vaayu
This is the new "Page" using Designer, they now have abilities to add CSS and JS when building a page which is pretty cool. Again I'm using 8206 Home page to perform this.


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 18, 2019, 02:21 PM
Waz
Yes, wasn't sure Designer was in 8.2.05.

You are going to have problems. W are in discussions with IBI to get the parms accessible.

Case open.

It looks promising but seems there is no functions available to retrieve the parms.

If you have the parms shown on the screen, you may be able to use js to collect them, but not sure if the values of select lists are available directly.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 18, 2019, 02:30 PM
vaayu
Thanks Waz,
I ended up grabbing the var as getelementById value and am able to pass it along in the URL. I'm hoping we'll see more IBComposer type functions exposed for designer.

-P


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 19, 2019, 04:48 PM
vaayu
This is the updated code just in case
 
window.addEventListener("iba_pageloading", function (e){
    var panel = document.querySelector(".custom1").ibaObject;
    var ibsite = panel.addButton({"glyphClasses": "fa fa-question", "class": "ibButton", "tooltip": "Visit IB Site"}, ".pd-container-title-button-resize", true);
    var exl = panel.addButton({"glyphClasses": "fa fa-file-excel-o", "class": "ibButton", "tooltip": "Excel Dowload"}, ".pd-container-title-button-resize", true);
    ibsite.addEventListener("click", function(){
        window.open("http://www.ibi.com");
    });
    exl.addEventListener("click", function(){
        var p = document.getElementById('ibx-aria-id-64').value;
        console.log(p);
        var url = './wfirs/ibfs/WFC/Repository/COE/USB_Locations/USB_Branch_Report.fex'  ;
        console.log(url);
        url = url + '?ZIPCODE=' + p ;
        url = url + '&FMT=XLSX' ;
        console.log('final url=' + url);
        window.open(url) ;
        
    });
}); 



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