Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.

Home Page:https://livewire-powergrid.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exporting a table with a collection just export the first page

marineusde opened this issue · comments

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

Thank you @zwhhz !