Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to export db fields of only ONE Dataobject in a cvs file from the edit area of the Dataobject?


Go to End


3 Posts   1395 Views

Avatar
iraira88

Community Member, 19 Posts

19 January 2016 at 1:11am

I know there is a GridFieldExportButton which exports all the data of a gridfield. But what I want is a custom Button which exports all the $db fields (ore just a few of them) of only ONE dataobject in a cvs-file and download it. So I want this button in the edit area of this one dataobject and not for the gridfield which shows all data objects.

I have already the button (through BetterButtonCustomAction of the BetterButtons module), now I need the right function. Can somebody help me?

Avatar
iraira88

Community Member, 19 Posts

26 January 2016 at 12:37am

Edited: 26/01/2016 12:38am

Nobody? :'(
Every hint would be helpful!

Avatar
Devlin

Community Member, 344 Posts

26 January 2016 at 10:32pm

I'm not sure where you'd need help. Obviously, you already have a button and probably a corresponding function too.

That function needs to do two things:
- parse a CSV string
- and send it to the browser as a file for download

Both things are really simple and should be solved after a couple of minutes on Google.