Skip to content

Commit 47baad2

Browse files
authored
use table-responsive not card overflow
1 parent 00d49f3 commit 47baad2

File tree

1 file changed

+46
-44
lines changed

1 file changed

+46
-44
lines changed

resources/views/table.blade.php

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,69 @@
1515
@endif
1616
</div>
1717

18-
<div class="card overflow-auto mb-3">
18+
<div class="card mb-3">
1919
@if($models->isEmpty())
2020
<div class="card-body">
2121
{{ __('No results to display.') }}
2222
</div>
2323
@else
2424
<div class="card-body p-0">
25-
<table class="table {{ $table_class }} mb-0">
26-
<thead class="{{ $thead_class }}">
27-
<tr>
28-
@if($checkbox && $checkbox_side == 'left')
29-
@include('laravel-livewire-tables::checkbox-all')
30-
@endif
31-
32-
@foreach($columns as $column)
33-
<th class="align-middle text-nowrap border-top-0 {{ $this->thClass($column->attribute) }}">
34-
@if($column->sortable)
35-
<span style="cursor: pointer;" wire:click="sort('{{ $column->attribute }}')">
36-
{{ $column->heading }}
37-
38-
@if($sort_attribute == $column->attribute)
39-
<i class="fa fa-sort-amount-{{ $sort_direction == 'asc' ? 'up-alt' : 'down' }}"></i>
40-
@else
41-
<i class="fa fa-sort-amount-up-alt" style="opacity: .35;"></i>
42-
@endif
43-
</span>
44-
@else
45-
{{ $column->heading }}
46-
@endif
47-
</th>
48-
@endforeach
49-
50-
@if($checkbox && $checkbox_side == 'right')
51-
@include('laravel-livewire-tables::checkbox-all')
52-
@endif
53-
</tr>
54-
</thead>
55-
<tbody>
56-
@foreach($models as $model)
57-
<tr class="{{ $this->trClass($model) }}">
25+
<div class="table-responsive">
26+
<table class="table {{ $table_class }} mb-0">
27+
<thead class="{{ $thead_class }}">
28+
<tr>
5829
@if($checkbox && $checkbox_side == 'left')
59-
@include('laravel-livewire-tables::checkbox-row')
30+
@include('laravel-livewire-tables::checkbox-all')
6031
@endif
6132

6233
@foreach($columns as $column)
63-
<td class="align-middle {{ $this->tdClass($column->attribute, $value = Arr::get($model->toArray(), $column->attribute)) }}">
64-
@if($column->view)
65-
@include($column->view)
34+
<th class="align-middle text-nowrap border-top-0 {{ $this->thClass($column->attribute) }}">
35+
@if($column->sortable)
36+
<span style="cursor: pointer;" wire:click="sort('{{ $column->attribute }}')">
37+
{{ $column->heading }}
38+
39+
@if($sort_attribute == $column->attribute)
40+
<i class="fa fa-sort-amount-{{ $sort_direction == 'asc' ? 'up-alt' : 'down' }}"></i>
41+
@else
42+
<i class="fa fa-sort-amount-up-alt" style="opacity: .35;"></i>
43+
@endif
44+
</span>
6645
@else
67-
{{ $value }}
46+
{{ $column->heading }}
6847
@endif
69-
</td>
48+
</th>
7049
@endforeach
7150

7251
@if($checkbox && $checkbox_side == 'right')
73-
@include('laravel-livewire-tables::checkbox-row')
52+
@include('laravel-livewire-tables::checkbox-all')
7453
@endif
7554
</tr>
76-
@endforeach
77-
</tbody>
78-
</table>
55+
</thead>
56+
<tbody>
57+
@foreach($models as $model)
58+
<tr class="{{ $this->trClass($model) }}">
59+
@if($checkbox && $checkbox_side == 'left')
60+
@include('laravel-livewire-tables::checkbox-row')
61+
@endif
62+
63+
@foreach($columns as $column)
64+
<td class="align-middle {{ $this->tdClass($column->attribute, $value = Arr::get($model->toArray(), $column->attribute)) }}">
65+
@if($column->view)
66+
@include($column->view)
67+
@else
68+
{{ $value }}
69+
@endif
70+
</td>
71+
@endforeach
72+
73+
@if($checkbox && $checkbox_side == 'right')
74+
@include('laravel-livewire-tables::checkbox-row')
75+
@endif
76+
</tr>
77+
@endforeach
78+
</tbody>
79+
</table>
80+
</div>
7981
</div>
8082
@endif
8183
</div>

0 commit comments

Comments
 (0)