Replies: 3 comments
-
I think you maybe able to accomplish this by publishing the blade templates for Splade and modifying table/controls.blade.php & table/bulk-actions-exports.blade.php. |
Beta Was this translation helpful? Give feedback.
-
I have done a work around job and fix this because I faced the same issue. I used bulk action to export the data instead of the export method. And eventually I sent the file using email because also I had the issue of not automatically and installed through the browser. In details: note: this is a better choice because it allows you to select the records that you want to download as CSV instead of downloading the whole model. Also saving the file inside the email is better for easier access in the future.. The details of the codes are the following: Inside your data table class, use bulk action: Within the same data table class and a method to handle the selected IDs:
here is the last responsible for exporting the data: ids = $ids; } public function collection() { return empty($this->ids) ? Note::all() : Note::whereIn('id', **$this->ids**)->get(); } } Mailable details: fileName = $fileName; } public function build() { return $this->markdown('emails.notes.exported') ->subject('Your Notes Export') ->attachFromStorage($this->fileName); } } |
Beta Was this translation helpful? Give feedback.
-
The solution that I have provided earlier appears to work only on the records available inside one page if you try to select 'all' the records it will not going to work. Which means that now it's necessary to send the ID (that has a relationship of one to many to the records) associated with the records (that belongs to that ID..) available inside the data table. Here is another solution to be able to send this ID by setting it as an attribute for the bulk action. Step 1: Define Extra Parameters in BulkAction Class // In BulkAction.php Step 2: Set Extra Parameters in HasBulkActions Trait // In HasBulkActions.php
} Step 3: Pass Product ID as an Extra Parameter // In ProductReviews.php Step 4: Access Product ID in the Bulk Action Method // In ProductReviews.php Step 5: Use Extra Parameters in Blade Template {{-- In your Blade template --}} |
Beta Was this translation helpful? Give feedback.
-
Can we customize the export, PDF, and CSV buttons in the x-splade-table component? Also, how can we use the route helper function to generate a link for exporting data in the x-splade-table component?
<x-splade-table :for="$auditLogs" search-debounce="1000" striped>
or Like this
<Link href="{{ route('splade.table.export', ['table' => 'users', 'export' => 'excel-export', 'slug' => 'my_slug']) }}">Excel Export</Link>
I am trying to achieve something like this structure.
You may use the built-in Artisan Command to show the installed versions of the packages:
Make sure both Splade packages (JS + PHP) are up-to-date and on the same version. For example, when using version 0.5.0 of the PHP package, you should use the same JavaScript package version.
Description:
Steps To Reproduce Issue:
Beta Was this translation helpful? Give feedback.
All reactions