exporting a table with a collection just export the first page
marineusde opened this issue · 2 comments
marineusde commented
Have you searched through other issues to see if your problem is already reported or has been fixed?
Yes, I did not find it.
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
Yes - I didn't work.
Is there an error in the console?
No
PHP Version
8.2.7
PowerGrid
5.4.8
Laravel
10.48.4
Livewire
3.4.9
Alpine JS
No response
Theme
Bootstrap
Describe the bug.
Try
To Reproduce...
final class TestTable extends PowerGridComponent
{
use WithExport;
public function datasource(): ?Collection
{
$collection = new Collection;
for ($i = 1; $i <= 20; $i++) {
$collection->add([
'id' => $i,
'name' => 'Name ' . $i
]);
}
// Have to do this to get paginating
$this->total = $collection->count();
return $collection;
}
public function setUp(): array
{
return [
Exportable::make('export')
->striped()
->type(Exportable::TYPE_XLS),
Header::make()->showSearchInput(),
Footer::make()
->showPerPage()
->showRecordCount(),
];
}
public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('id')
->add('name');
}
public function columns(): array
{
return [
Column::make('ID', 'id'),
Column::make('Name', 'name'),
];
}
}
Extra information
No response
luanfreitasdev commented
Thank you @zwhhz !