You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may wish to hide the table on load. To do so, you should use the following in the mount method. Note that this is in mount, not boot nor configure!
7
+
8
+
```php
9
+
public function mount()
10
+
{
11
+
$this->setShouldBeHidden();
12
+
}
13
+
```
14
+
15
+
### Using Events To Display/Hide
16
+
17
+
For example, you may have a "Sales" table that you wish to hide by default:
18
+
```php
19
+
class SalesTable extends DataTableComponent
20
+
{
21
+
public string $tableName = 'sales'; // Required to keep the call specific
22
+
23
+
public function mount()
24
+
{
25
+
$this->setShouldBeHidden(); // Defaults the table to be hidden, note that this is in MOUNT and not CONFIGURE
26
+
}
27
+
28
+
// Configure/Columns/Filters etc
29
+
}
30
+
```
31
+
32
+
The Table allows for different approaches, out-of-the-box it supports the more efficient client-side listeners.
33
+
34
+
However - should you wish to use Livewire listeners in your table component, for example if you wish to pass more detail into the Table then you can:
35
+
36
+
```php
37
+
#[On('showTable.{tableName}')]
38
+
public function showTable(): void
39
+
{
40
+
$this->setShouldBeDisplayed();
41
+
}
42
+
43
+
#[On('hideTable.{tableName}')]
44
+
public function hideTable(): void
45
+
{
46
+
$this->setShouldBeHidden();
47
+
}
48
+
```
49
+
50
+
51
+
### Secondary Table
52
+
Below are the two approaches. Note that you can customise the Livewire "On" to pass additional details should you wish.
0 commit comments