Power-Components / livewire-powergrid

⚑ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.5k stars 219 forks source link

No Numeric Formatting in Excel? #447

Closed saezels closed 2 years ago

saezels commented 2 years ago

PowerGrid Bug Report

Thank you for reporting a bug and helping us to improve PowerGrid!

Guidelines

πŸ› We use GitHub Issues exclusively for tracking bugs and unexpected software behavior.

πŸ™ Please use the Discussions tab for questions like "How to...", "how can I..." .

✍️ Give this report a short but meaningful title. Make it easy to spot for others who might be facing the same issue.

⚠️ Issues that do not describe a bug or do not follow the template will be closed.

Information

Pre-steps

Have you searched through other issues to see if your problem is already reported or has been fixed?

Did you read the documentation?

Have you tried to publish the views?

You can publish the views to make sure there is no "old code" trapped in views which are not up-to-date.

To publish, run: php artisan vendor:publish --tag=livewire-powergrid-views

Is there an error in the console?

Software Version

You can run composer show -i and npm list to list installed package with their versions.

Software Version (exactly)
PowerGrid v3.0.1
Laravel v9.0.2
Livewire v2.10.2
Alpine JS 3.9.0

Theme


Describe the bug

When Using Export, every Numeric Column is formatted as Text in Excel besides the Id

What happened?

Every Cell is formatted as Text and has to be converted to Numbers in Excel.

To Reproduce...

Klick "Export Excel"

Suggestions

(Do you have any idea how we can fix it?)

Extra information

Screenshots

Code snippet

<?php

//...
saezels commented 2 years ago

I found a workaround how it works:

[...] ->addColumn('AvailableStock', function(Product $product){ return intval($product->AvailableStock); }) [...]

Is there a possibility to get it as an Integer directly? In the database its int too

luanfreitasdev commented 2 years ago

Hi, I believe this is the best solution. πŸ‘

ashek1412 commented 8 months ago

I tired the solution provided by @saezels , but not working. Even ID field shows as text in excel. I am using livewire-powergrid: "4.9.8"