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 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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Export Data from the front end [solved]

Go to End

3 Posts   1468 Views


Community Member, 201 Posts

19 August 2014 at 2:38am

Hi ya,

ok i'm hoping this is a simple one and its just my lack of sleep that is stopping me from getting the answer. I have created an export fields function that works great from the model admin as per the

What i would like to do is to run the export function from the front end just by pushing a button on a management page.

Any pointers?




Community Member, 201 Posts

20 August 2014 at 12:24am


Currently i have this function in my model admin and it works perfect but i don't want to give the users backend access to the system so just want to export all the records at a push of a button.

Hope some one can help.


public function getExportFields() {
        return array(
        'ID' => 'ID',
        'Area.Name' => 'Area',
        'DateMissing.Nice' => 'Date Missing',
        'MisperType.Name' => 'Misper Type',
        'Gender' => 'Gender',
        'Age'=> 'Age',
        'TOD' => 'Time of Day',
        'IPPGR' => 'IPP Grid',
        'DateFound.Nice' => 'Date Found',
        'FindGR' => 'Find Grid',
        'Dist' => 'Distance from IPP (km)',
        'Location.Name' => 'Location Type',
        'Survivability.Name' => 'Survivability',
        'DestGR' => 'Destination Grid',
        'TrackOff' => 'Track Offset (m)',
        'AreaType' => 'Area Type',
   		'DateCalledOut' => 'Callout Date',
   		'MissingLoc.Name' => 'Missing From',
        'Notes' => 'Notes'


Community Member, 201 Posts

21 August 2014 at 1:46am

Ok got around this using a gridfield and a little help from here [link] [/link]

public function AllSearches() {
        $config = GridFieldConfig::create();
        $config->addComponents(new GridFieldExportAllButton());
        $form = Form::create(
                LiteralField::create("LiteralField","<legend>Export All Search Data</legend>" ),
                LiteralField::create("LiteralField","<div class='large-12 medium-12 columns'>" ),
                    GridField::create('SearchGrid', 'Searches', new DataList('TheSearch'), $config),
                LiteralField::create("LiteralField","</div>" )
        return $form;