12 June, 2012

Genius ADF Buttons


I will present some genius ADF buttons that doing specific actions using Javascript


Print Page
I use the following button to print page content using window.print() method in Javascript.

 <af:commandButton text="Print Page" id="print_cb">  
     <af:clientListener type="click" method="window.print"/>  
 </af:commandButton>  

Note you can use Show Printable Page Behavior operation to do the same purpose

<af:commandButton text="Print Page" id="print_cb">  
     <af:showPrintablePageBehavior/>  
 </af:commandButton>  

Open Website
I use the following button for opening a website in new window.

  <af:commandButton text="Open Dive in Oracle" id="open_cb">  
     <af:clientListener type="click"   
        method="window.open('http://www.mahmoudoracle.blogspot.com', '_blank')"/>  
 </af:commandButton>  

Note you can use Go button for the same operation.

 <af:goButton text="Open Dive in Oracle (Go)" id="gb1" targetFrame="_blank"  
                      destination="http://www.mahmoudoracle.blogspot.com"/>  


Close Window
I use the following button to close browser window

 <af:commandButton text="Close Page" id="close_cb">  
      <af:clientListener type="action" method="window.close"/>  
 </af:commandButton>  

Thanks

1 comment:

  1. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

    Alena

    Diverticulitis Treatment Diverticulitis Diet

    ReplyDelete

How to Pass Parameters to ActionListener in ADF

In some cases, it is required to pass a value to ActionListener of ADF Button. The method that can be invoked by actionListeners has only...