Export Few column to excel using propertyListener in ADF

If you want to export only few of the column of your table in ADF then follow this approach

inside exportCollectionListener use propertyListener like

<af:commandButton text="Export To excel" id="cb1">
            <af:setPropertyListener from="true"
                                    to="#{pageFlowScope.hideSomeColumns}"
                                    type="action"/>
            <af:exportCollectionActionListener exportedId="t1" type="excelHTML"
                                               title="Employee"
                                               filename="EmployeeData.xls"/>
            <af:setPropertyListener from="false"
                                    to="#{pageFlowScope.hideSomeColumns}"
                                    type="action"/>
          </af:commandButton>

 

and inside columns you can write an el in visible property as

]
<af:column sortProperty="#{bindings.Employees1.hints.LastName.name}"
                       sortable="false"
                       headerText="#{bindings.Employees1.hints.LastName.label}"
                       id="c7"
                       visible="#{pageFlowScope.hideSomeColumns ne true}">

  

Then only few columns will be exported.See the video

Download the sample application from here exportFewColumnExcel

Happy learning by Vinay Kumar in techartifact….