Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: fast excel export via Column's exportRender() #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

ejgandelaberon
Copy link

Since this pull request, per cell styling is supported via exportFormat() of Column class.

This pull request takes it further by supporting the exportRender() of Column when using fast excel to provide another way to modify cell data.

Usage

class YourDataTable extends DataTable
{
    protected bool $fastExcel = true;
    
    public function html()
    {
        return $this->builder()
            ->columns([
                \Yajra\DataTables\Html\Column::make('created_at')->exportRender(function ($row, $data) {
                    return \Carbon\Carbon::parse($data)->format('m/d/Y h:i a');
                })
            ]);
    }
}

Copy link

sonarqubecloud bot commented Sep 4, 2024

@yajra yajra merged commit b9a36aa into yajra:master Sep 5, 2024
6 checks passed
@yajra
Copy link
Owner

yajra commented Sep 5, 2024

@OzanKurt
Copy link
Contributor

OzanKurt commented Sep 9, 2024

Great update, I was using if (request('action') === 'excel') to modify editColumns.

Thanks @ejgandelaberon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants