Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 48 additions & 12 deletions FEATURE_ROW_ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ Adds an action button whose icon is resolved per row by calling `iconProvider` w

---

#### Removing row actions

```java
void removeRowAction(EasyRowAction<T> action);
```
Removes the specified action from the actions column. Equivalent to calling `action.remove()`.

---

#### Rendering mode

```java
Expand All @@ -71,6 +62,33 @@ Returns the `Grid.Column<T>` backing the actions column, allowing the caller to

---

#### Default theme variants

```java
void setDefaultRowActionVariants(ButtonVariant... variants);
```
Sets the Vaadin `ButtonVariant`s applied by default to every action button created *after* this call; actions added earlier are unaffected. The built-in default is `LUMO_TERTIARY_INLINE`. Pass no arguments (or `null`) to clear the defaults. Individual actions can still add their own variants via `EasyRowAction.addThemeVariants(...)`.

---

#### Custom renderer

```java
void setRowActionsRenderer(RowActionsRenderer<T> renderer);
```
Replaces the strategy that turns the registered actions into UI. The built-in inline-button and context-menu renderers (selected via `setRowActionsAsMenu`) cover the common cases; supply a custom `RowActionsRenderer<T>` to present actions another way. The previous renderer is cleaned up and a rebuild is scheduled.

---

#### Refreshing after configuration changes

```java
void refreshRowActions();
```
Schedules a rebuild of the actions column on the next server response. The fluent `EasyRowAction` methods (`visibleWhen`, `enabledWhen`, `tooltip`, `withConfirmation`) already trigger this automatically, so an explicit call is only needed after changing an action's attribute or property, which are not applied automatically.

---

### `EasyRowAction<T>`

All mutator methods return `this` to support method chaining.
Expand Down Expand Up @@ -117,12 +135,25 @@ Intercepts button clicks and presents a confirmation dialog before invoking the

---

#### Styling and theme variants

`EasyRowAction<T>` implements `HasStyle` and `HasThemeVariant<ButtonVariant>`, so the action's button can be styled and themed directly:

```java
action.addClassName("danger");
action.getStyle().set("font-weight", "bold");
action.addThemeVariants(ButtonVariant.LUMO_ERROR);
```
These are forwarded onto the rendered button. Unlike the fluent mutators above, style and theme-variant changes made after the grid has already rendered are **not** applied automatically — call `easyGrid.refreshRowActions()` afterwards to make them visible.

---

#### Removal

```java
void remove();
```
Removes this action from the actions column and triggers an immediate re-render so the change is visible without waiting for a data refresh. Equivalent to calling `easyGrid.removeRowAction(this)`. If the action has already been removed, this call is a no-op. After removal the `EasyRowAction` reference is considered dead and cannot be re-added; call `addRowAction` again to create a new action.
Removes this action from the actions column and triggers an immediate re-render so the change is visible without waiting for a data refresh. If the action has already been removed, this call is a no-op. After removal the `EasyRowAction` reference is considered dead and cannot be re-added; call `addRowAction` again to create a new action.

---

Expand Down Expand Up @@ -163,10 +194,15 @@ easyGrid.addRowAction("Deactivate", VaadinIcon.CLOSE, person -> {
// Removing an action
EasyRowAction<Person> adminAction = easyGrid.addRowAction("Purge", VaadinIcon.TRASH, item -> purge(item));
// later:
easyGrid.removeRowAction(adminAction);
// or equivalently, if only the action reference is in scope:
adminAction.remove();

// Default theme variants applied to every action added afterwards
easyGrid.setDefaultRowActionVariants(ButtonVariant.LUMO_SMALL, ButtonVariant.LUMO_TERTIARY);

// Style or theme an individual action's button
easyGrid.addRowAction("Reset", person -> reset(person))
.addClassName("warning");

// Configure the actions column via the underlying Grid.Column
easyGrid.getActionsColumn()
.setHeader("Actions")
Expand Down
Loading