Skip to content

Commit d53dd7d

Browse files
authored
Merge pull request #59 from alexpm51/Add-buttonName-option
feat: add button name option
2 parents bfef13d + 27c920c commit d53dd7d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,23 @@ $schedule->command('datatables:purge-export')->weekly();
8888
You can set the export filename by setting the property.
8989

9090
```html
91-
9291
<livewire:export-button :table-id="$dataTable->getTableId()" filename="my-table.xlsx"/>
9392
<livewire:export-button :table-id="$dataTable->getTableId()" filename="my-table.csv"/>
9493

9594
<livewire:export-button :table-id="$dataTable->getTableId()" :filename="$filename"/>
9695
```
9796

97+
## Export Button Name
98+
99+
You can set the export button name by setting the `buttonName` property.
100+
101+
```html
102+
<!-- Examples demonstrating how to customize the button name for different scenarios -->
103+
<livewire:export-button :table-id="$dataTable->getTableId()" type="xlsx" buttonName="Export Excel"/>
104+
<livewire:export-button :table-id="$dataTable->getTableId()" type="csv" buttonName="Export CSV"/>
105+
106+
```
107+
98108
## Export Type
99109

100110
You can set the export type by setting the property to `csv` or `xlsx`. Default value is `xlsx`.

src/Livewire/ExportButtonComponent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class ExportButtonComponent extends Component
2525

2626
public string $filename = '';
2727

28+
public string $buttonName = 'Export';
29+
2830
public string $sheetName = 'Sheet1';
2931

3032
public bool $autoDownload = false;

src/resources/views/export-button.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
searchParams.set('action', 'exportQueue');
1111
searchParams.set('exportType', '{{$fileType}}');
1212
searchParams.set('sheetName', '{{$sheetName}}');
13+
searchParams.set('buttonName', '{{$buttonName}}');
1314
searchParams.set('emailTo', '{{urlencode($emailTo)}}');
1415
1516
var tableParams = $.param(oTable.ajax.params());
@@ -35,7 +36,7 @@
3536
x-ref="exportBtn"
3637
:disabled="$wire.exporting"
3738
class="{{ $class }}"
38-
>Export
39+
>{{$buttonName}}
3940
</button>
4041
</form>
4142

0 commit comments

Comments
 (0)