Skip to content

Commit f07d7f2

Browse files
committed
Added back modals view
1 parent 24e21fb commit f07d7f2

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Added space to include custom markup at the end of the component.
10+
711
## [2.1.0] - 2022-04-12
812

913
### Added

docs/misc/custom-markup.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Adding Custom Markup
3+
weight: 3
4+
---
5+
6+
If you would like to append any custom markup right before the end of the component, you may use the `customView` method and return a view.
7+
8+
This is good for loading extra content such as modals.
9+
10+
```php
11+
public function customView(): string
12+
{
13+
return 'includes.custom';
14+
}
15+
```

docs/misc/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Debugging
3-
weight: 3
3+
weight: 4
44
---
55

66
## Configuration

docs/upgrade-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ New:
5555
```php
5656
$this->getAppliedFilterWithValue('active');
5757
```
58+
59+
## Modals
60+
61+
`modalsView()` was changed to `customView()`

resources/views/datatable.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@
6060
</x-livewire-tables::table>
6161

6262
<x-livewire-tables::pagination :rows="$rows" />
63+
64+
@isset($customView)
65+
@include($customView)
66+
@endisset
6367
</x-livewire-tables::wrapper>

resources/views/stubs/custom.blade.php

Whitespace-only changes.

src/DataTableComponent.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ public function builder(): Builder
9696
throw new DataTableConfigurationException('You must either specify a model or implement the builder method.');
9797
}
9898

99+
/**
100+
* The view to add any modals for the table, could also be used for any non-visible html
101+
*
102+
* @return string
103+
*/
104+
public function customView(): string
105+
{
106+
return 'livewire-tables::stubs.custom';
107+
}
108+
99109
/**
100110
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
101111
*/
@@ -105,6 +115,7 @@ public function render()
105115
->with([
106116
'columns' => $this->getColumns(),
107117
'rows' => $this->getRows(),
118+
'customView' => $this->customView(),
108119
]);
109120
}
110121
}

0 commit comments

Comments
 (0)