Make the whole row clickable #984
Replies: 6 comments 2 replies
-
Can you give more details? |
Beta Was this translation helpful? Give feedback.
-
Is this already possible? :) |
Beta Was this translation helpful? Give feedback.
-
Is this possible? I need this for my project. |
Beta Was this translation helpful? Give feedback.
-
I would like to know if there is a solution for this. |
Beta Was this translation helpful? Give feedback.
-
A hacky solution and set an Action Rule that adds an attribute wire-click to fire an event and a second rule to set the mouse pointer. However, this solution will NOT WORK in combination with using Action Buttons, Checkboxes, Detail Row or Toggleable switches, as this event will be fire on click. Code: use PowerComponents\LivewirePowerGrid\Facades\Rule;
use Livewire\Attributes\On;
public function actionRules($row): array
{
return [
Rule::rows()
->when(fn () => true)
->setAttribute('wire:click', "clickToEdit({$row->id}, '{$row->name}')"),
Rule::rows()
->when(fn () => true)
->setAttribute('class', 'cursor-pointer'),
];
}
#[On('clickToEdit')]
public function clickToEdit(int $dishId, string $dishName): void
{
$this->js("alert('Editing #{$dishId} - {$dishName}')");
} |
Beta Was this translation helpful? Give feedback.
-
I would really like to be able to click the entire row. |
Beta Was this translation helpful? Give feedback.
-
⚡ PowerGrid ⚡ Feature Request
Summary
I appreciate the ability to have action buttons and collapsable rows but I wish I could trigger an action (like opening a window) if I clicked on the whole row.
Why is this needed?
Because the limitation on just having the action buttons doesn't cover all use cases
Suggested Solution(s)
Probably a new method like SetRowsAttributes, with the possibility to only apply the action to certain rows.
Related issue(s)/PR(s)
I didn't find any issue or PR related to this.
Thanks for your help !
Beta Was this translation helpful? Give feedback.
All reactions