-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Are you planning to add a non-livewire version for this? #55
Comments
No plans but open for a PR if you can. Thanks! |
So... I've been playing around with the export package and actually found out that integrating it with buttons is extremely simple. I added this custom button which sends an ajax request to the server side and it gets handled by the DataTable.ext.buttons.exportQueue = {
className: 'buttons-export-queue',
text: function (dt) {
return '<i class="far fa-fw fa-file-excel"></i>';
},
action: function (e, dt, button, config) {
var url = _buildUrl(dt, 'exportQueue');
$.ajax({
url: url,
type: 'GET',
data: {},
complete: window.ajax_complete_handler,
});
}
}; There are a couple of ideas I've had: 1- We need to add a customizable callback function to the public function exportQueue(): string
{
$job = new DataTableExportJob(
[self::class, $this->attributes],
request()->all(),
Auth::id() ?? 0,
$this->sheetName(),
);
$batch = Bus::batch([$job])->name('datatables-export')->dispatch();
return $batch->id;
} 2- I had to implement a public function getUser(): ?User
{
return $this->user ? User::find($this->user) : null;
} 3- We need to be able to handle the errors that might occur during the Job: 4- I think the mail should be separated from the Job Maybe something like this: public function afterExport(array $paths): bool
{
// The `$paths` can contain multiple paths of the file like:
// ['local' => 'localpath', 's3' => 's3path', 'otherDisk' => 'otherpath']
// do some stuff with the exported file, maybe save it to an archive inside the media-library.
// return `true` to continue with the email
// return `false` to skip email, and maybe send the file to every user in a team
} 5- I don't think we need a job_batch for this since it's only 1 job, we should be able to dispatch the single job alone. (I don't have much exp. with batches, so no judgement 😞) 6- Ability to add multiple destination disks 7- Ability to send the job to multiple users (this can be done manually if we implement "step 4") 9- Customizable mail_subject 10- A nicer Email Template from Laravels defaults 😄 Let me know what you think about these ideas. I also believe that this package could be integrated inside the buttons package directly, only the So, inside the ExportServiceProvider we can add something like this: if (class_exists('Livewire\\Livewire')) {
// Do livewire related inits
} |
Good points provided @OzanKurt. Will also try to implement it if I can.
The package idea came from Laravel Daily |
A non-livewire version would be much appreciated. |
This would be extremely useful for me, in case you can implement it partially I could also continue.
The text was updated successfully, but these errors were encountered: