-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #682 from rappasoft/develop
V2
- Loading branch information
Showing
338 changed files
with
15,698 additions
and
7,012 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: v1 | ||
title: v2 | ||
slogan: A dynamic table component for Laravel Livewire. | ||
githubUrl: https://github.com/rappasoft/laravel-livewire-tables | ||
branch: v1 | ||
branch: master | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
title: Bulk Actions | ||
weight: 6 | ||
weight: 8 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
--- | ||
title: Available Methods | ||
weight: 4 | ||
--- | ||
|
||
These are the available configuration methods for bulk actions. | ||
|
||
--- | ||
|
||
## setBulkActions | ||
|
||
Set the bulk actions array. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
$this->setBulkActions([ | ||
'exportSelected' => 'Export', | ||
]); | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## setBulkActionsStatus | ||
|
||
**Enabled by default**, enable/disable bulk actions for the component. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
$this->setBulkActionsStatus(true); | ||
$this->setBulkActionsStatus(false); | ||
} | ||
``` | ||
|
||
## setBulkActionsEnabled | ||
|
||
Enable bulk actions on the component. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setBulkActionsStatus(true) | ||
$this->setBulkActionsEnabled(); | ||
} | ||
``` | ||
|
||
## setBulkActionsDisabled | ||
|
||
Disable bulk actions on the component. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setBulkActionsStatus(false) | ||
$this->setBulkActionsDisabled(); | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## setSelectAllStatus | ||
|
||
**Disabled by default**, enable/disable pre-selection of all bulk action check boxes. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
$this->setSelectAllStatus(true); | ||
$this->setSelectAllStatus(false); | ||
} | ||
``` | ||
|
||
## setSelectAllEnabled | ||
|
||
Check all bulk action checkboxes. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setSelectAllStatus(true) | ||
$this->setSelectAllEnabled(); | ||
} | ||
``` | ||
|
||
## setSelectAllDisabled | ||
|
||
Deselect the select-all bulk actions checkbox. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setSelectAllStatus(false) | ||
$this->setSelectAllDisabled(); | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## setHideBulkActionsWhenEmptyStatus | ||
|
||
**Disabled by default**, enable/disable hiding of bulk actions dropdown when empty. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
$this->setHideBulkActionsWhenEmptyStatus(true); | ||
$this->setHideBulkActionsWhenEmptyStatus(false); | ||
} | ||
``` | ||
|
||
## setHideBulkActionsWhenEmptyEnabled | ||
|
||
Hide bulk actions dropdown when empty. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setHideBulkActionsWhenEmptyStatus(true) | ||
$this->setHideBulkActionsWhenEmptyEnabled(); | ||
} | ||
``` | ||
|
||
## setHideBulkActionsWhenEmptyDisabled | ||
|
||
Show bulk actions dropdown when empty. | ||
|
||
```php | ||
public function configure(): void | ||
{ | ||
// Shorthand for $this->setHideBulkActionsWhenEmptyStatus(false) | ||
$this->setHideBulkActionsWhenEmptyDisabled(); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
--- | ||
title: Creating bulk actions | ||
title: Creating Bulk Actions | ||
weight: 2 | ||
--- | ||
|
||
To create bulk actions, you must specify a `method` and a `button title` in the `$bulkActions` component property. | ||
There are 3 ways to define your bulk actions. | ||
|
||
They all do the same thing except provide different levels of flexibility. | ||
|
||
The **key** is the Livewire method to call, and the value is the name of the item in the bulk actions dropdown. | ||
|
||
## Property | ||
|
||
The first way to define your bulk actions is with the `bulkActions` component property: | ||
|
||
```php | ||
public array $bulkActions = [ | ||
'exportSelected' => 'Export', | ||
]; | ||
``` | ||
|
||
------ | ||
## Method | ||
|
||
**The following method is only available in v1.16 and above** | ||
|
||
As of v1.16 you can define bulk action with a method, so you can perform other actions to determine what your actions are or perform translations on the strings: | ||
You can also use the `bulkActions` method on the component: | ||
|
||
```php | ||
public function bulkActions(): array | ||
{ | ||
// Figure out what actions the admin gets | ||
... | ||
|
||
return [ | ||
'activate' => __('Activate'), | ||
'deactivate' => __('Deactivate'), | ||
'exportSelected' => 'Export', | ||
]; | ||
} | ||
``` | ||
|
||
------ | ||
## Configuration | ||
|
||
The **key** is the Livewire method to call, and the value is the name of the item in the bulk actions dropdown. | ||
|
||
You can define your method to do whatever you want: | ||
You can also set them via the component's configure method: | ||
|
||
```php | ||
public function exportSelected() | ||
public function configure(): void | ||
{ | ||
// Do something with the selected rows. | ||
$this->setBulkActions([ | ||
'exportSelected' => 'Export', | ||
]); | ||
} | ||
``` | ||
|
||
See [Getting the selected rows query](./getting-the-selected-rows-query) or [Getting the selected keys](./getting-the-selected-keys) to understand how to work with the selected data. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Processing Bulk Actions | ||
weight: 3 | ||
--- | ||
|
||
To process your bulk action you must have a method on the component with the same name as the key in the bulk actions array: | ||
|
||
```php | ||
public array $bulkActions = [ | ||
'exportSelected' => 'Export', | ||
]; | ||
|
||
public function exportSelected() | ||
{ | ||
|
||
} | ||
``` | ||
|
||
You have access to the `selectedKeys` method to grab the IDs of the rows that were selected: | ||
|
||
```php | ||
public function exportSelected() | ||
{ | ||
foreach($this->getSelected() as $item) | ||
{ | ||
// These are strings since they came from an HTML element | ||
} | ||
} | ||
``` | ||
|
||
## Resetting | ||
|
||
After you process your action you'll probably want to reset the screen back to normal, for this you can call the `clearSelected` method at the end: | ||
|
||
```php | ||
public function exportSelected() | ||
{ | ||
... | ||
|
||
$this->clearSelected(); | ||
} | ||
``` |
Oops, something went wrong.