Skip to content

Commit 16c5acd

Browse files
committed
Fixed issue where non-sorted column header didn't get attributes applied
Updated documentation
1 parent 5193372 commit 16c5acd

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
## [0.3.1] - 2020-09-18
8+
9+
### Changed
10+
11+
- Fixed non-sortable column headers not getting classes applied.
12+
- Updated documentation
13+
714
## [0.3] - 2020-09-16
815

916
- Ground up rebuild
@@ -112,7 +119,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
112119

113120
- Initial release
114121

115-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.3.0...development
122+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.3.1...development
123+
[0.3.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.3.0...v0.3.1
116124
[0.3.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.2.1...v0.3.0
117125
[0.2.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.2.0...v0.2.1
118126
[0.2.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.6...v0.2.0

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,19 @@ You can define the columns of your table with the column class.
126126
The following methods are available to chain to a column:
127127

128128
```php
129+
130+
/**
131+
* The first argument is the column header text
132+
* The attribute can be omitted if the text is equal to the lower case snake_cased version of the column
133+
* The attribute can also be used to reference a relationship (i.e. role.name)
134+
*/
135+
public function make($text, ?$attribute) : Column;
136+
129137
/**
130138
* Used to format the column data in different ways, see the HTML Components section.
131139
* You will be passed the current model and column (if you need it for some reason) which can be omitted as an argument if you don't need it.
132140
*/
133-
public function format(Model $model, Column $column) : self;
141+
public function format(callable $callable = null) : self;
134142

135143
/**
136144
* This column is searchable, with no callback it will search the column by name or by the supplied relationship, using a callback overrides the default searching functionality.

resources/views/bootstrap-4/includes/columns.blade.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ class="{{ $this->setTableHeadClass($column->getAttribute()) }}"
2222
@endif
2323
</th>
2424
@else
25-
<th>{{ $column->getText() }}</th>
25+
<th
26+
class="{{ $this->setTableHeadClass($column->getAttribute()) }}"
27+
id="{{ $this->setTableHeadId($column->getAttribute()) }}"
28+
@foreach ($this->setTableHeadAttributes($column->getAttribute()) as $key => $value)
29+
{{ $key }}="{{ $value }}"
30+
@endforeach
31+
>
32+
{{ $column->getText() }}
33+
</th>
2634
@endif
2735
@endif
2836
@endforeach

0 commit comments

Comments
 (0)