I will continue to enhance my Working with Popups post and will add a export to excel functionality to af:table component. You will know the power of ADF with just simple clicks you are able to add this functionality to table.
What you will learn
- Functionality of af:panelCollection
- Working with menus
- Adding Exporting to excel behavior to the af:table
Download this workspace change connection settings and follow steps
Adding Panel Collection
- Open the countries.jspx page and select af:table component in structure window give this table a proper name i.e "myTab" by setting id property of the table in property Inspector.
- Right click the af:table component and choose "Surround with..." and Choose Panel Collection
Note: A panel component that aggregates collection components like table, treeTable and tree to display standard/application menus, toolbars and statusbar items
Adding a Menu in Panel Collection
- Drop af:menu component in the Menu facet of the Panel collection set the Text property as "File"
- Drop af:menuitem on af:menu set the Text property as "Export to Excel"
Adding Export behavior to Menu
- Drop an af:exportCollectionActionListener to the Menu item. A dialog box will appear choose type as the only option available "excelHTML" Choose exportedId from the menu choose edit navigate through the nodes and find af:table "myTab" click OK and OK again.
- Complete Structure window would looks like this
- Set the properties of the af:exportCollectionActionListener as shown in the slide for more meaningful file name and title of worksheet
Run the Form
- Right click on the countries.jspx page and choose Run
- Page similar to this will appear Choose File > Export to Excel from the Menu
I hope this post would be helpful feel free to comment
Download my working example