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

No comments:

Post a Comment

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...