alperenersoy / filament-export Goto Github PK
View Code? Open in Web Editor NEWCustomizable export and print functionality for Filament Admin Panel
Customizable export and print functionality for Filament Admin Panel
Sorry for this noob question but what "use" should I use
Hi,
how can i change the language of the labels?
Thanks
If there's null value on our data, when exporting data to xls, the excel package (simple-excel / openspout) will throw an exception that is not properly handled. So the export will stuck on loading state.
The fix / workaround is by casting the state on the line below to string.
filament-export/src/FilamentExport.php
Line 285 in d128a0c
$item[$column->getName()] = (string)$state;
I am not able to print on clicking print button and getting following error in console.
Uncaught ReferenceError: printTable is not defined
I am using only filament-forms and filament-table packages.
Please help me.
When I add an extra TextColumn via the withColums
method with the method enum on it crashes the export and returns an error.
->withColumns([
TextColumn::make('gender')
->label(__('fields.member.fields.gender.label'))
->enum(GenderEnum::casesWithLabels())
])
GenderEnum function
public static function casesWithLabels(): array
{
$labels = [];
foreach (self::cases() as $case) {
$labels[$case->value] = __('genders.' . $case->value);
}
return $labels;
}
Error message in console
Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
value index.js:75
promise callback*value/< index.js:70
promise callback*value index.js:68
sendMessage index.js:242
value index.js:252
later debounce.js:8
setTimeout handler*debounce/< debounce.js:12
value index.js:225
debouncedHandler node_initializer.js:243
value index.js:582
debouncedHandler node_initializer.js:201
attachListener node_initializer.js:259
attachDomListener node_initializer.js:181
initialize node_initializer.js:42
initialize node_initializer.js:15
value index.js:92
value index.js:525
walk walk.js:5
walk walk.js:10
walk walk.js:10
walk walk.js:10
value index.js:511
value index.js:90
Component index.js:51
value index.js:88
value index.js:87
<anonymous> Ember
gt app.js:1
start app.js:1
888 app.js:90
i app.js:90
<anonymous> app.js:90
O app.js:90
<anonymous> app.js:90
<anonymous> app.js:90
index.js:75:57
I am facing an issue while exporting a table containing a column with html in it. The exported column contains the HTML. I was able to fix it by publishing the views and change
{{ $row[$column->getName()] }} to {!! $row[$column->getName()] !!} and it works
But I am wondering if I will face new issues with that ? Of not, why not change those statements in the views of the package ? I can make a PR for that if you agree
This appears to only export columns that are visible in the table (ie hidden columns, or columns toggled off are not available).
Is there a way to export all fields? Or an array of fields, or all except?
Perhaps I just missed something in the docs.
Great plugin though!
Normally, the data comes, but when I want to print out, this data either comes incorrectly or not at all. Before using the pivot table, such a problem did not exist. This happened when I started using a pivot table
I am getting issue while installing this.
My php and filament version is
php: "^8.0.2",
filament/filament": "^2.0"
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpoffice/phpspreadsheet[1.18.0, ..., 1.22.0] require psr/simple-cache ^1.0 -> found psr/simple-cache[1.0.0, 1.0.1] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- phpoffice/phpspreadsheet[1.23.0, ..., 1.24.1] require psr/simple-cache ^1.0 || ^2.0 -> found psr/simple-cache[1.0.0, 1.0.1, 2.0.0, 2.x-dev] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.7) does not satisfy that requirement.
- maatwebsite/excel[3.1.26, ..., 3.1.35] require illuminate/support 5.8.*|^6.0|^7.0|^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
- alperenersoy/filament-export v0.1.6 requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].
- maatwebsite/excel[3.1.36, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1].
- Root composer.json requires alperenersoy/filament-export ^0.1.6 -> satisfiable by alperenersoy/filament-export[v0.1.6].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require alperenersoy/filament-export:*" to figure out if any version is installable, or "composer require alperenersoy/filament-export:^2.1" if you know which you need.
Your package has also barryvdh/laravel-snappy dependency
Hello, i have a problem when i try to export a textColumn which have multiple values:
Forms\Components\Select::make('voltaje_prim_trafo')
...
->multiple()
->options([...
Tables\Columns\TextColumn::make('voltaje_prim_trafo')
..._
the error is next:
htmlspecialchars(): Argument #1 ($string) must be of type string, array given
Hello everyone
I have this error htmlspecialchars(): Argument #1 ($string) must be of type string, array given
you can see in here
and I've been try to debug it but I can't find any clue unless one clue that maybe because my json column on my modal?
maybe someone have another clue about this error? Thanks
Hello does it support Async export for large datasets ? thanks
hi when i try to print document its giving me blank page but on preview its showing all row and col . and when i try to export to pdf some col is cutting off on exported document .
I am getting this issue while trying to export all data.
Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'offset 0' at line 1
Hi, I found issue when using TextColumn with rowIndex()
The index column is working normally in filament table view. It filled ordered number from $rowLoop. When I export the table using this plugin, and click Preview button, the modal was pop up, all record is normal, but index column show blanks, while export and print button, debugger showing this error:
Filament\Tables\Columns\TextColumn::Filament\Tables\Columns\{closure}(): Argument #1 ($rowLoop) must be of type stdClass, null given, called in /Users/umar/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php on line 36
.
Please help. Thanks.
Hey,
it is possible to set the csv delimiter?
Hi,
I tried both bulk export and header export but what I get is a big white box in the middle of my screen forever.
my code is as follow
->headerActions([
FilamentExportHeaderAction::make('export'),
]);
and for bulk action it is similar except it is FilamentExportBulkAction
My table has 2500 records
Does it have a plan to filter by date range?
Class "App\Filament\Resources\FilamentExportBulkAction" not found
Having this error. what am I to import, or how do I solve the issue?
Hi,
Is there a way to set default additional columns please?
Basically I want to export every column on the model, but not sure how to go about it without adding them into the Modal each time I export.
Thanks,
Danny
I'm building out an order export system using the Filament Admin Panel. My listing table shows orders which have a HasMany relationship to order line items like so:
/**
* Get the items for the order.
*/
public function items(): HasMany
{
return $this->hasMany(OrderItem::class, 'order_id', 'order_id');
}
I need to be able to export a CSV or XLSX file of the orders along with their related line items, so if an order has 5 related line items, there would be 5 rows for this order in the exported file, with the order data (name, address, email, etc.) being static and only the line item data changing between the rows.
For example, a RIGHT JOIN
like this would return what I need:
SELECT * FROM order_items RIGHT JOIN orders ON order_items.order_id = orders.order_id
However, I don't understand if it's possible to decouple/override the query that the exporter is using from the Filament resource, which is using the Order
model.
Is it possible to do this?
Using SQL Server, when selecting 3000 records (All) we get:
SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters. (SQL: select * from
There are two solutions I can see:
thoughts?
Hello,
This package is awesome, Thanks!
It would be good to have a way to modify SimpleExcelWriter before download, maybe defining a function with a closure beforeDownloading(function (SimpleExcelWriter $writer) {...})
. That would allow the developer to further personalize the download (by applying custom formats, column witdths, etc.).
allow column to be exported which is not listed in table but is there in record details.
Hello,
In the database structure this package requires ID exists. As an example, I have set the primaryKey within the list resource to be ClientID which is defined as part of the database I am getting data from. But when exporting, it fails because column ID doesn't exist.. Is it possible to change that?
Hey there,
I'm sure I'm missing something blindingly obvious here but I seem to be missing a number of filament methods or templates when trying to use filament-export and cannot for the life of me figure out where I've gone wrong!
I'm using:
"php": "^8.0",
"filament/filament": "^2.0",
"filament/forms": "^2.0",
"filament/tables": "^2.0",
"alperenersoy/filament-export": "^0.2.8",
And I've been through filament-export resources folder and commented out where I could find Action::make()->icon() in use but it just seems to find another component that is missing each time such as the x-filament-support::model template and more.
What am I missing here? I'm positive it's a me problem but hoping you may be able to shine a light on this...
Thanks
Tom
it would be nice to have the ability to exclude columns to be exported.
the problem is the same as #21 . I have read all the issues but have not found a solution
public function getTableQuery(): Builder
{
$record = Route::current()->record;
return PlanKegiatanPengajuanPerjalananDinas::query()
->where('pengajuan_perjalanan_dinas_id', $record);
}
am I missing somthing?
thanks in advance
have the possibility to sort / arrange the columns in the export.
I have a few columns I'd like to format from 1 / 0 to Yes / No. What's the best way to achieve this with Filament-export?
exporting fields (xls/csv/pdf) of a relationship returns null..
Am I wrong or did I miss something in the documentation?
Thanks,
Hey!
First of all thank you for this great package <3
I was woundring if you would support more languages? e.g. Arabic.
And also.. I would be happy to work on those languages files! Thanks again.
when changing from xsl to pdf it doesnt show
same when changing from pdf to xslx doesnt hide.
Hi,
Thanks for the great package, am wondering if you can tag a 1.0 or 0.x release on github so we can use it.
Header actions must be an instance of Filament\Actions\Action, or Filament\Actions\ActionGroup.
in version 3.0.0-bate
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
FilamentExportHeaderAction::make('export'),
];
}
It will be good idea to have fully custom multiple header action, i dont know if its already there, but I tried its not working
use AlperenErsoy\FilamentExport\Actions\FilamentExportHeaderAction;
->headerActions([
FilamentExportHeaderAction::make('Export')->defaultFormat('pdf')->label('Export PDF'),
FilamentExportHeaderAction::make('Export')->defaultFormat('xlsx')->label('Export Excel'),
FilamentExportHeaderAction::make('Export')->defaultFormat('csv')->label('Export CSV')
])
Filament v3 has been released. Will you be supporting it?
for example I have changed getTableQuery
in my list page
protected function getTableQuery(): Builder
{
if (auth()->user()->isAdmin) {
return parent::getTableQuery();
} elseif (auth()->user()->isDoctor) {
return parent::getTableQuery()
->whereIn('page_id', auth()->user()->pages()->pluck('id'));
} else {
return parent::getTableQuery()
->when(
auth()->user()->branch_id,
fn ($q) => $q->where('branch_id', auth()->user()->branch_id)
);
}
}
the FilamentExportHeaderAction
exports all of table records
am I missing somthing?
thanks in advance
First of all, thank you for your plugin. It works really well and has been exactly what I needed several times.
Now to the issue: The docs on the page https://filamentphp.com/plugins/alperenersoy-export are unfortunately relatively old compared to the README.md from Github. I therefore spent some time thinking about how to include the hidden columns, until I realised that the source code for this was already available.
It is possible to use belongsToThrough relationship to export table?
Hello,
I detect a problem when try to install the package using composer with php 8.2.
I think you can upgrade spatie laravel excel to work, the bundle was updates to use newest version of spout
Thanks
FilamentExportBulkAction::make(__('Export'))
->extraViewData(function ($action) {
return [
'recordCount' => $action->getRecords()->count()
];
}),
gives error:
Undefined variable $recordCount
when using this blade variable in table_view.blade.php as defined in readme.md
{{ $recordCount }}
but it works in pdf.blade.php
In admin panels it can consume a lot of width if full URLs etc. are shown, so I have truncated them with ->limit()
, and when exporting via header actions, the truncated values are being brought into the XLSX sheet. Is there a way to bypass this for the exports?
Example code:
<?php
namespace App\Filament\Resources;
use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Resources\ExampleResource\Pages;
use App\Filament\Resources\ExampleResource\RelationManagers;
use App\Models\Example;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
class ExampleResource extends Resource
{
protected static ?string $model = Example::class;
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Example';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')->required(),
Forms\Components\Textarea::make('description'),
Forms\Components\Select::make('owner_id')->relationship('owner', 'name')->label('Owner')->required(),
Forms\Components\Select::make('category_id')->relationship('category', 'name')->label('Category')->required(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')->label('ID')->sortable(),
Tables\Columns\TextColumn::make('name')->sortable()->limit(30),
Tables\Columns\TextColumn::make('description')->sortable()->limit(30),
Tables\Columns\TextColumn::make('category.name')->sortable(),
Tables\Columns\TextColumn::make('owner.email')->sortable(),
Tables\Columns\TextColumn::make('created_at')->dateTime()->sortable(),
Tables\Columns\TextColumn::make('updated_at')->dateTime()->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
FilamentExportBulkAction::make('export'),
])
->headerActions([
FilamentExportHeaderAction::make('export'),
])
->defaultSort('id', 'desc');
}
public static function getPages(): array
{
return [
'index' => Pages\ListExample::route('/'),
'create' => Pages\CreateExample::route('/create'),
'view' => Pages\ViewExample::route('/{record}'),
'edit' => Pages\EditExample::route('/{record}/edit'),
];
}
}
Does It support Laravel-Excel View method?
Tables\Columns\TextColumn::make('invoice_items_sum_total')->sum('invoiceItems','total')->label('Bill Amount'),`
First of all, this package is fantastic, thanks for making it!
I believe this is related to #21. I've got a table which is just aggregated data.
public function getTableQuery(): Builder
{
return Participantprogramsession::query()
->join('participants', 'participantprogramsessions.participant_id', 'participants.id')
->where('participantprogramsessions.status', '=', 0)
->select(DB::raw('count(participants.tshirt_size) as count, participants.tshirt_size'))
->groupBy('participants.tshirt_size');
}
When I try to export, it returns just the headings "Size" and "Count" but no data. Is there a way to fix this?
P.S. I was able to get it working perfectly using a more "normal" eloquent query.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.