Skip to content

Commit 7e15550

Browse files
committed
Add Number Column Documentation
1 parent ca9567b commit 7e15550

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Number Columns
3+
weight: 15
4+
---
5+
6+
Number Columns are Standard Columns, with the difference being that the defaultValue expects and returns a numeric value, rather than a string, and the Sorting Pills default to Numeric Behaviour (0-9, 9-0).
7+
8+
```php
9+
NumberColumn::make('Likes', 'likes')
10+
->defaultValue('0') // Can be a string, int, or float
11+
->sortable(),
12+
```
13+
14+
15+
Please also see the following for other available methods:
16+
<ul>
17+
<li>
18+
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/available-methods">Available Methods</a>
19+
</li>
20+
<li>
21+
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/column-selection">Column Selection</a>
22+
</li>
23+
<li>
24+
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/secondary-header">Secondary Header</a>
25+
</li>
26+
<li>
27+
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/footer">Footer</a>
28+
</li>
29+
</ul>

docs/column-types/sum_column.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Sum Columns (beta)
3-
weight: 15
3+
weight: 16
44
---
55

66
Sum columns provide an easy way to display the "Sum" of a field on a relation.

docs/column-types/view_component_column.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: View Component Columns
3-
weight: 16
3+
weight: 17
44
---
55

66
View Component columns let you specify a component name and attributes and provide attributes to the View Component. This will render the View Component in it's entirety.

docs/column-types/wire_link_column.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Wire Link Column (beta)
3-
weight: 17
3+
weight: 18
44
---
55

66
WireLink columns provide a way to display Wired Links in your table without having to use `format()` or partial views, with or without a Confirmation Message

src/Features/Columns/Views/NumberColumn.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(string $title, ?string $from = null)
2323
if (! isset($from)) {
2424
$this->label(fn () => null);
2525
}
26-
26+
$this->setSortingPillDirections('0-9','9-0');
2727
}
2828

2929
/**
@@ -36,4 +36,5 @@ public function getValue(Model $row): string
3636
{
3737
return parent::getValue($row) ?? $this->getDefaultValue();
3838
}
39+
3940
}

0 commit comments

Comments
 (0)