1

Good morning, I need implement "p:dataExporter" of primefaces in bootfaces but i think that bootfaces cant implement this functionality. I only need export datas of my b:dataTables to Excels (CSV).

Is it possible to perform this functionality? In PrimeFaces is implemented as follows:

<p:dataTable id="tbl" var="car" value="#{dataExporterView.cars}"
             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
             paginator="true" rows="10" style="margin-bottom:20px">

<p:dataExporter type="csv" target="tbl" fileName="cars" pageOnly="true" />

Thanks so much.

danysion
  • 45
  • 9

1 Answers1

0

Currently, there's no export function in b:dataTable. This includes both the current version 0.9.1 and the upcoming version 1.0.

However, you should be able to add such a functionality yourself. b:dataTable is based on the datatable hosted at Datatables.net. This widget, in turn, has an extension adding CSV, PDF and Excel exports. Currently, we don't include this extension with BootsFaces, so you have to add the corresponding JavaScript file yourself. Here's the description of the API of the exporter of DataTables.net: https://datatables.net/extensions/buttons/examples/initialisation/export.html.

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37
  • Stephan, i have a technical question about this answer: I am implementing your solution, i have the code of DataTables.net: https://datatables.net/extensions/buttons/examples/initialisation/export.html. But i have a simple problem , why if i have labels of jsf ( ) my code dont work? and if replace for body this work....i need jsf. What can i do ? Thanks for all. – danysion Jan 13 '17 at 11:08
  • Might be an id problem. JSF does funny things with the ids. It makes them unique by adding the parent id separated by a colon. jQuery doesn't cope with colons (unless you escape them), and your HTML-only demo probably doesn't use compound ids. Hope that helps! – Stephan Rauh Jan 13 '17 at 11:28