Skip to content

Commit 1e4b7bb

Browse files
committed
Add deselect column configuration
1 parent 2788f4a commit 1e4b7bb

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/Traits/WithColumnSelect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function mountWithColumnSelect(): void
2929
// Get a list of visible default columns that are not excluded
3030
$columns = collect($this->getColumns())
3131
->filter(function ($column) {
32-
return $column->isVisible() && $column->isSelectable();
32+
return $column->isVisible() && $column->isSelectable() && $column->isSelected();
3333
})
3434
->map(fn ($column) => $column->getHash())
3535
->values()

src/Views/Column.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Column
4949
protected $labelCallback;
5050
protected bool $hidden = false;
5151
protected bool $selectable = true;
52+
protected bool $selected = true;
5253
protected bool $secondaryHeader = false;
5354
protected $secondaryHeaderCallback;
5455
protected bool $footer = false;

src/Views/Traits/Configuration/ColumnConfiguration.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ public function excludeFromColumnSelect(): self
149149
return $this;
150150
}
151151

152+
/**
153+
* @return $this
154+
*/
155+
public function deselect(): self
156+
{
157+
$this->selected = false;
158+
159+
return $this;
160+
}
161+
152162
/**
153163
* @param string $field
154164
*

src/Views/Traits/Helpers/ColumnHelpers.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,14 @@ public function isSelectable(): bool
413413
return $this->selectable === true;
414414
}
415415

416+
/**
417+
* @return bool
418+
*/
419+
public function isSelected(): bool
420+
{
421+
return $this->selected === true;
422+
}
423+
416424
/**
417425
* @return bool
418426
*/

0 commit comments

Comments
 (0)