Skip to content

Commit fa3f5bd

Browse files
committed
Add checked user column selection
1 parent ed03c58 commit fa3f5bd

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Traits/WithColumnSelect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function mountWithColumnSelect(): void
2121

2222
// Get a list of visible default columns that are not excluded
2323
$columns = collect($this->columns())
24-
->filter(fn ($column) => $column->isVisible() && $column->isSelectable())
24+
->filter(fn ($column) => $column->isVisible() && $column->isSelectable() && $column->isSelected())
2525
->map(fn ($column) => $column->column())
2626
->values()
2727
->toArray();

src/Views/Column.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class Column
7474
*/
7575
public bool $selectable = true;
7676

77+
/**
78+
* @var bool
79+
*/
80+
public bool $selected = false;
81+
7782
/**
7883
* Column constructor.
7984
*
@@ -335,4 +340,22 @@ public function isSelectable(): bool
335340
{
336341
return $this->selectable === true;
337342
}
343+
344+
/**
345+
* @return $this
346+
*/
347+
public function selected(): self
348+
{
349+
$this->selected = true;
350+
351+
return $this;
352+
}
353+
354+
/**
355+
* @return bool
356+
*/
357+
public function isSelected(): bool
358+
{
359+
return $this->selected;
360+
}
338361
}

0 commit comments

Comments
 (0)