mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-06 01:31:22 +02:00
Merge pull request #3567 from stephenmcm/gridfieldexportbutton-patch
FIX GridFieldExportButton exporting only Paginated list when using ArrayList as source
This commit is contained in:
commit
c8ad29f0d7
@ -119,6 +119,9 @@ class GridFieldExportButton implements GridField_HTMLProvider, GridField_ActionP
|
||||
$fileData .= "\n";
|
||||
}
|
||||
|
||||
//Remove GridFieldPaginator as we're going to export the entire list.
|
||||
$gridField->getConfig()->removeComponentsByType('GridFieldPaginator');
|
||||
|
||||
$items = $gridField->getManipulatedList();
|
||||
|
||||
// @todo should GridFieldComponents change behaviour based on whether others are available in the config?
|
||||
|
@ -74,6 +74,27 @@ class GridFieldExportButtonTest extends SapphireTest {
|
||||
);
|
||||
}
|
||||
|
||||
public function testArrayListInput() {
|
||||
$button = new GridFieldExportButton();
|
||||
$this->gridField->getConfig()->addComponent(new GridFieldPaginator());
|
||||
|
||||
//Create an ArrayList 1 greater the Paginator's default 15 rows
|
||||
$arrayList = new ArrayList();
|
||||
for ($i = 1; $i <= 16; $i++) {
|
||||
$dataobject = new DataObject(
|
||||
array ( 'ID' => $i )
|
||||
);
|
||||
$arrayList->add($dataobject);
|
||||
}
|
||||
$this->gridField->setList($arrayList);
|
||||
|
||||
$this->assertEquals(
|
||||
"\"ID\"\n\"1\"\n\"2\"\n\"3\"\n\"4\"\n\"5\"\n\"6\"\n\"7\"\n\"8\"\n"
|
||||
."\"9\"\n\"10\"\n\"11\"\n\"12\"\n\"13\"\n\"14\"\n\"15\"\n\"16\"\n",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
class GridFieldExportButtonTest_Team extends DataObject implements TestOnly {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user