PHP code example of silverstripe / gridfieldqueuedexport

1. Go to this page and download the library: Download silverstripe/gridfieldqueuedexport library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

silverstripe / gridfieldqueuedexport example snippets


$gridField = GridField::create('Pages', 'All pages', SiteTree::get())
$config = $gridField->getConfig();
$config->addComponent(GridFieldQueuedExportButton::create('buttons-after-left'));

// Find GridField
$gridField = $fields->fieldByName('MyGridField');
$config = $gridField->getConfig();

// Add new component
$oldExportButton = $config->getComponentByType(GridFieldExportButton::class);
$config->addComponent($newExportButton = GridFieldQueuedExportButton::create('buttons-after-left'));

// Set Header and Export columns on new Export Button
$newExportButton->setCsvHasHeader($oldExportButton->getCsvHasHeader()); 
$newExportButton->setExportColumns($oldExportButton->getExportColumns());

// Remove original component
$config->removeComponentsByType(GridFieldExportButton::class);