Skip to content

Commit 5143413

Browse files
committed
docs: 📝 update README with aggregate columns support
1 parent 5b2639c commit 5143413

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,48 @@ class OrdersTable extends Component
155155
}
156156
```
157157

158+
### Column Aggregates
159+
160+
Columns support aggregate calculations that display in the table footer.
161+
162+
#### Summable Columns
163+
164+
Add `.summable()` to display column totals:
165+
166+
```php
167+
Column::add('total', 'Total')
168+
->summable(),
169+
170+
Column::add('quantity', 'Quantity')
171+
->summable(),
172+
```
173+
174+
#### Averageable Columns
175+
176+
Add `.averageable()` to display column averages:
177+
178+
```php
179+
Column::add('rating', 'Rating')
180+
->averageable(),
181+
182+
Column::add('price', 'Price')
183+
->averageable(),
184+
```
185+
186+
#### Combined Aggregates
187+
188+
Columns can display both sum and average:
189+
190+
```php
191+
Column::add('amount', 'Amount')
192+
->summable()
193+
->averageable(),
194+
```
195+
196+
When both aggregates are present, they display as:
197+
- **Sum: 1,500.00**
198+
- **Avg: 150.00**
199+
158200
### Column Filters.
159201

160202
Filters allow you to filter data displayed in the grid.

0 commit comments

Comments
 (0)