DataExporter exports duplicate values

UI Components for JSF
Post Reply
sorabh6
Posts: 2
Joined: 30 Dec 2016, 08:24

30 Dec 2016, 08:38

DataExporter duplicates the values shown in datatable. For ex: If a column in datatable contains value "1", on export the value in exported file becomes "11" for every column except headers.

I am using primefaces version 5.3 and primefaces-extensions version 4.0.0

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Dec 2016, 10:36

This does not happen in the showcase, so I'm pretty sure it is a problem on your side. See http://forum.primefaces.org/viewtopic.php?f=3&t=1194 (The part about code... also google about mcve or sscce

sorabh6
Posts: 2
Joined: 30 Dec 2016, 08:24

30 Dec 2016, 11:25

Thanks for your response Ron!

The code I am working on is secured, thus can not share it. Also, I have analyzed it further to see when there is a <p:tooltip> tag added, then only exporter duplicates values. For reference, below is the dummy code for column specified in datatable with tooltip.

Code: Select all

<p:column sortBy="#{car.color}" headerText="Color">
      <h:outputText id="carColor" value="#{car.color}" />
      <p:tooltip id="tooltipColor" for="carColor" trackMouse="true" value="#{car.color}"/>
</p:column>
>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Dec 2016, 13:07

Offtopic: You can in 99.9% of the cases always create an 'mcve' without violating 'security' policies. (I know, I have a security background to)
sorabh6 wrote:Also, I have analyzed it further to see when there is a <p:tooltip> tag added, then only exporter duplicates values. For reference, below is the dummy code for column specified in datatable with tooltip.

Code: Select all

<p:column sortBy="#{car.color}" headerText="Color">
      <h:outputText id="carColor" value="#{car.color}" />
      <p:tooltip id="tooltipColor" for="carColor" trackMouse="true" value="#{car.color}"/>
</p:column>
>
Then download the exporter source and check if it indeed processes the p:tooltip to and then make it ignore it. Or maybe you can use the rendered attribute of the tooltip with some creative EL in it that detects an export and return false.

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

30 Dec 2016, 13:46

You can move tooltip outside of datatable(You can use selectors to find the target) or You can use extensions custom exporter to skip tooltip component.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Dec 2016, 15:22

@Sudheer: Sure, but why does it export tooltips at all?

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

31 Dec 2016, 08:08

Because the exporter class tries to export the content of p:column component.I mean it won't skip or filter any kind of data https://github.com/primefaces/primeface ... orter.java.By the way Happy new year to you :)
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Montyzoomer
Posts: 33
Joined: 01 May 2012, 12:08

11 Dec 2018, 13:34

What i did was to move the tooltips into another column that was not being exported.
There was no special selectors required.

That solved it for me.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 40 guests