Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added export functionality to pivotUI #187

Closed
wants to merge 1 commit into from

Conversation

ashesnz
Copy link

@ashesnz ashesnz commented Jul 24, 2014

Hello Nicolas,

Thought I might contribute to this fantastic library of yours. Added an optional field to pivoutUI in which the user can export the table.

I had to normalize the table before being able to do this, as it got quite difficult due to the rowspan/colspans involved.

Feel free to merge, if you so desired

@jawaharprasad
Copy link

Works well but it repeats the first dimension column twice.. in your PR, it repeats the COLOR column in both A,B Columns in excel

@nicolaskruchten
Copy link
Owner

Thanks for this! I'm getting married soon so I won't have a ton of time to look at this until September, but I just wanted to let you know I'm grateful and I'm not ignoring you :)

@nicolaskruchten
Copy link
Owner

Thanks again for the contribution, but commit f636484 is my preferred way of implementing exporting: via an optional Renderer component which directly accesses the underlying PivotData object rather than by patching the core and parsing the output of another Renderer.

@LaurensRietveld
Copy link
Contributor

@nicolaskruchten : not really sure this is the best place for the bug report, but I noticed two strange issues:

@nicolaskruchten
Copy link
Owner

@LaurensRietveld thanks for the feedback!

  • I should probably add the totals columns back in, you're right that it's inconsistent
  • yes, it's intentional as it simplifies importing into many tools which expect a single row of headers... having multiple rows of headers makes things complicated in a layout like TSV which doesn't have intuitive support for multi-row/multi-column cells. I tried various options that didn't do this but I always ended up with either a blank row or a blank column in the layout and it wasn't very satisfying

I'm very open to suggestions as to alternative ways of doing this, though!

@LaurensRietveld
Copy link
Contributor

Sorry about the delay!

I think there is no -proper- way of doing this, and what table layout to use mostly depends on a persons taste. I have two main requirements:

  1. it should resemble the regular table layout as much as possible
  2. the csv should support the use in easily applying postprocessing in e.g. excel

So for (1) I'd opt for including the row-headers instead of concatenating these with the cell values. And for (2), I'd simply duplicate a row span value into the corresponding cells.

But again, this is just my personal preference, and I'm not claiming this to be -the- best approach ;)
It's not the prettiest solution, but I doubt there is any...

ps. Something more related to the UI part of this issue: if you share my preference for requirement (1), then it might be better to make this agnostic to the underlying data object, and generate the exported csv on the actual html table. This would make it easier to keep the CSV as consistent as possible with the regular table renderer(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants