MedicOneSystems / MedicOneSystems/livewire-datatables

Attempt to read property "preventExport" on int

Open
#481 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

Hello guys, I have the following problem, install livewire according to the indicated steps and when showing a datatable and exporting it throws the following message:

Attempt to read property "preventExport" on int

View:

<livewire:datatable 
                        model="App\Models\User" 
                        name="all-users"
                        exclude="created_at,updated_at,id"                      
                        exportable  
                        complex="true"
                       
    />

Error Detail

  public function getExportResultsSet()

    {

        return $this->mapCallbacks(

            $this->getQuery()->when(count($this->selected), function ($query) {

                return $query->havingRaw('checkbox_attribute IN (' . implode(',', $this->selected) . ')');

            })->get(),

            true

        )->map(function ($item) {

            return collect($this->columns())->reject(function ($value, $key) {

                return $value->preventExport == true || $value->hidden == true;

            })->mapWithKeys(function ($value, $key) use ($item) {

                return [$value->label ?? $value->name => $item->{$value->name}];

            })->all();

        });

    }

more detail

https://flareapp.io/share/OmVDER87

greetings and thank you very much

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with getExportResultsSet() and inspect the values returned by columns(), especially the entries used by the reject callback. Reproduce the export with the shown livewire:datatable configuration and verify that exporting handles the column definitions without attempting property access on an integer.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.