pe:exporter, exclude facet or ui components inside facet

Community Driven Extensions Project
rodmc
Posts: 14
Joined: 26 Apr 2013, 17:44

29 Jun 2013, 06:56

i have this situation:

Code: Select all

 <f:facet name="header">
                       Recepciones

                           <div id="calendario">

                           Desde <p:calendar id="from"  value="#{recepciones.from}" styleClass="calendarFilter">
                                <p:ajax event="dateSelect"  update="from" />
                            </p:calendar>
                           Hasta <p:calendar id="to" value="#{recepciones.to}" styleClass="calendarFilter">
                                <p:ajax event="dateSelect"  update="to" />
                            </p:calendar>
                            <h:commandButton id="botonf" value="Ver" type="submit" actionListener="#{recepciones.procFecha}" >
                                <f:ajax render=":formRecepciones:dataTable2"/>
                            </h:commandButton>
                        </div>
</f:facet>
when i export the table i get "javax.faces.component.UIPanel@404baf" instead of the title of the table (the table is exported anyway, just the title is wrong) is there some way i can hide the ui component from the facet?? i need that section to be inside the facet.. i tried surrounding the div's with p:column and "exportable=false" but it did not work and f:facet does not have an "exportable" attribute like p:column.

i dont care if i lose the title of the table , i just dont want to have "javax.faces.component.UIPanel@404baf" over my table.

thanks!

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

30 Jun 2013, 06:08

exportable="false" only for the p:column.You can use h:panelGroup to generate DIV element

Code: Select all

<h:panelGroup layout="block"/>
Use customExporter feature to escape the panelGroup component or UIPanel then you can get table title
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

rodmc
Posts: 14
Joined: 26 Apr 2013, 17:44

01 Jul 2013, 18:24

a custom exporter? i dont even know how to make a custom exporter.. but i think ill have to do it because i also need to change the column width, in the exported file i get all the column of the same size.


can you post a little example of a custom exporter? i saw in other post i had to create a META-INF folder in resources/services but i did not understood very well the process...

pleasee help!

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

02 Jul 2013, 08:35

I got many requests to add showcase example for customExporter.It will impact other examples So i didn't add any example for it.I will add the example later in a different way.Actually it will be simple procedure.

Steps for custom exporter http://fractalsoft.net/primeext-showcas ... porter.jsf and search for the examples for custom exporter in the forum.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

rodmc
Posts: 14
Joined: 26 Apr 2013, 17:44

03 Jul 2013, 22:18

thanks, but i dont understand very well the instructions :cry:

i really need some code example to understand how this whole thing works! it would be awesome if you can put an example atleast here of how to create a custom exporter and add it a function to set width in columns or exclude some ui component..

a lot of people is asking for examples of this because a lot of people need it, it is not very useful being able to export a table if you cant change the column width

ill keep trying to understand how to create a the custom exporter but if you can add the example, it would be very appreciated!

rodmc
Posts: 14
Joined: 26 Apr 2013, 17:44

04 Jul 2013, 23:33

sudheer i really need help here :(

this is what ive done by now:

1) under resources i created META-INF/services

2) inside services i created an empty text file called "Bean.ExporterFactory" (Bean is the package where my CustomExporterFactory is)

3) inside the file i added this line "Bean.CustomExporterFactory"

4) i created a java class (under my Bean package) called "CustomExporterFactory".

5) i made copy/paste of "DefaultExporterFactory" from here: https://github.com/primefaces-extension ... vider.java into my "CustomExporterFactory" class i created in step 4. (of course i changed the class name to "CustomExporterFactory"..

6) i created a java class called "PDFCustomExporter" under my "Bean" package, inside of it i made copy/paste of this: https://github.com/primefaces-extension ... orter.java

7) under META-INF/services i created a file called "Bean.PDFExporter" and inside of it i wrote Bean.PDFCustomExporter


8) now what? are all this steps ok by now? or im missing some steps ? i really have searched in this forum but everything regarding to the custom pdf exporter is so confusing and unclear that i dont know what to do.. i saw your other post about this but i did not understood anything.. i did all this trying to follow that post..

now how can i call my PDFCustomExporter from the view?? if i write pe:exporter.PDFCustomExporter it is not recognized and i did not understood very well the service loader stuff (yes i saw tha page explaining it, but i still dont get how to use it in this case)

pd. i also tried calling the files: org.primefaces.extensions.component.exporter.ExporterFactory and "Bean.CustomExporterFactory" inside the file

the other file org.primefaces.extensions.component.exporter.PDFExporter and inside "Bean.PDFCustomExporter".. but nothing..

please please help!! :cry:

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

05 Jul 2013, 09:45

rodmc wrote:sudheer i really need help here :(

this is what ive done by now:

1) under resources i created META-INF/services

2) inside services i created an empty text file called "Bean.ExporterFactory" (Bean is the package where my CustomExporterFactory is)

3) inside the file i added this line "Bean.CustomExporterFactory"

4) i created a java class (under my Bean package) called "CustomExporterFactory".

5) i made copy/paste of "DefaultExporterFactory" from here: https://github.com/primefaces-extension ... vider.java into my "CustomExporterFactory" class i created in step 4. (of course i changed the class name to "CustomExporterFactory"..

6) i created a java class called "PDFCustomExporter" under my "Bean" package, inside of it i made copy/paste of this: https://github.com/primefaces-extension ... orter.java

7) under META-INF/services i created a file called "Bean.PDFExporter" and inside of it i wrote Bean.PDFCustomExporter


8) now what? are all this steps ok by now? or im missing some steps ? i really have searched in this forum but everything regarding to the custom pdf exporter is so confusing and unclear that i dont know what to do.. i saw your other post about this but i did not understood anything.. i did all this trying to follow that post..

now how can i call my PDFCustomExporter from the view?? if i write pe:exporter.PDFCustomExporter it is not recognized and i did not understood very well the service loader stuff (yes i saw tha page explaining it, but i still dont get how to use it in this case)

pd. i also tried calling the files: org.primefaces.extensions.component.exporter.ExporterFactory and "Bean.CustomExporterFactory" inside the file

the other file org.primefaces.extensions.component.exporter.PDFExporter and inside "Bean.PDFCustomExporter".. but nothing..

please please help!! :cry:
see my response below

1) correct
2) wrong.file name should be "org.primefaces.extensions.component.exporter.ExporterFactory"
3)correct
4)correct
5)correct.And change the name of PDFExporter to PDFCustomExporter
6)correct
7)wrong.This step is not needed and shouldn't do that

Now your application will call your own custom export instead default export.I will add the showcase example soon (and becasue of work load I didn't get the time to do that).If you still facing issues then you can reach my account sudheer.jonna@gmail.com.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

rodmc
Posts: 14
Joined: 26 Apr 2013, 17:44

07 Jul 2013, 20:16

sudheer wrote:
rodmc wrote:sudheer i really need help here :(

this is what ive done by now:

1) under resources i created META-INF/services

2) inside services i created an empty text file called "Bean.ExporterFactory" (Bean is the package where my CustomExporterFactory is)

3) inside the file i added this line "Bean.CustomExporterFactory"

4) i created a java class (under my Bean package) called "CustomExporterFactory".

5) i made copy/paste of "DefaultExporterFactory" from here: https://github.com/primefaces-extension ... vider.java into my "CustomExporterFactory" class i created in step 4. (of course i changed the class name to "CustomExporterFactory"..

6) i created a java class called "PDFCustomExporter" under my "Bean" package, inside of it i made copy/paste of this: https://github.com/primefaces-extension ... orter.java

7) under META-INF/services i created a file called "Bean.PDFExporter" and inside of it i wrote Bean.PDFCustomExporter


8) now what? are all this steps ok by now? or im missing some steps ? i really have searched in this forum but everything regarding to the custom pdf exporter is so confusing and unclear that i dont know what to do.. i saw your other post about this but i did not understood anything.. i did all this trying to follow that post..

now how can i call my PDFCustomExporter from the view?? if i write pe:exporter.PDFCustomExporter it is not recognized and i did not understood very well the service loader stuff (yes i saw tha page explaining it, but i still dont get how to use it in this case)

pd. i also tried calling the files: org.primefaces.extensions.component.exporter.ExporterFactory and "Bean.CustomExporterFactory" inside the file

the other file org.primefaces.extensions.component.exporter.PDFExporter and inside "Bean.PDFCustomExporter".. but nothing..

please please help!! :cry:
see my response below

1) correct
2) wrong.file name should be "org.primefaces.extensions.component.exporter.ExporterFactory"
3)correct
4)correct
5)correct.And change the name of PDFExporter to PDFCustomExporter
6)correct
7)wrong.This step is not needed and shouldn't do that

Now your application will call your own custom export instead default export.I will add the showcase example soon (and becasue of work load I didn't get the time to do that).If you still facing issues then you can reach my account sudheer.jonna@gmail.com.
thanks, i sent you an email ;)

bhoen
Posts: 8
Joined: 24 Jul 2013, 07:03

24 Jul 2013, 12:18

Hi Sudheer,

After all the above steps have been done, how do I test this feature?

And these are the names of my classes

Code: Select all

com.webquote.web.quote.CustomExporterFactory //specified in WebContent/resources/META-INF/services/org.primefaces.extensions.component.exporter.ExporterFactory

com.webquote.web.quote.XLSXCustomExporter
Do I still call the function from my xhtml as such?

My CommandButton looks like this:

Code: Select all

<p:commandButton value="XLSX Download" ajax="false">  
	        	<pe:exporter type="xlsx" tableTitle="Response Internal Transfer Data" target="datatable_response_internal_transfer" fileName="ritdata"/>
	        </p:commandButton> 
It is not making a connection at the moment, would really appreciate the help.

Thanks

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

24 Jul 2013, 12:35

If you follow all the steps properly then it will load your custom Exporter instead built-in exporter.You don't need to do anything from xhtml code.I will add the showcase example soon,may today evening I will add
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests