Remark: I tried https://www.primefaces.org/stateful-column-toggler/ but it's not working.
I am using p:columnToggler to hide column of p:dataTable it's working fine,but when i am using Export as .pdf/.csv/.xls the hidden columns are also coming into Exported file.
Requirements:I want excludethose hiddden columns in Exported file.
i am using columnToggler like:<p:columnToggler datasource="cars" trigger="toggler" />
I forgot to post an answer, so after a long time, I am posting it may this help someone.
I followed primefaces.org/stateful-column-toggler but instead of setting visible="" I used exportable=""
<p:column headerText="Id" exportable="#{dtBasicView.list[0]}"> <h:outputText value="#{car.id}" /> </p:column>