Skip to content

Commit 78ccc88

Browse files
authored
Merge pull request #2693 from marzochi/disableTools
disableTools method for grid
2 parents cbade34 + 20f577b commit 78ccc88

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

docs/en/model-grid.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ $grid->disableCreateButton();
141141
$grid->disablePagination();
142142
```
143143

144+
#### Disable all tools on header of grid. Filter, refresh, export, batch actions
145+
```php
146+
$grid->disableTools();
147+
```
148+
144149
#### Disable data filter
145150
```php
146151
$grid->disableFilter();

resources/views/grid/table.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
</div>
66
@endif
77

8+
@if ( $grid->allowTools() || $grid->allowExport() || $grid->allowCreation() )
89
<div class="box-header with-border">
910
<div class="pull-right">
1011
{!! $grid->renderExportButton() !!}
1112
{!! $grid->renderCreateButton() !!}
1213
</div>
14+
@if ( $grid->allowTools() )
1315
<span>
1416
{!! $grid->renderHeaderTools() !!}
1517
</span>
18+
@endif
1619
</div>
20+
@endif
1721

1822
{!! $grid->renderFilter() !!}
1923

src/Grid.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class Grid
149149
*/
150150
protected $options = [
151151
'usePagination' => true,
152+
'useTools' => true,
152153
'useFilter' => true,
153154
'useExporter' => true,
154155
'useActions' => true,
@@ -535,6 +536,17 @@ public function build()
535536
$this->builded = true;
536537
}
537538

539+
/**
540+
* Disable header tools.
541+
*
542+
* @return $this
543+
*/
544+
public function disableTools()
545+
{
546+
$this->option('useTools', false);
547+
return $this;
548+
}
549+
538550
/**
539551
* Disable grid filter.
540552
*
@@ -719,6 +731,16 @@ public function getCreateUrl()
719731
);
720732
}
721733

734+
/**
735+
* If grid allows to use header tools
736+
*
737+
* @return bool
738+
*/
739+
public function allowTools()
740+
{
741+
return $this->option('useTools');
742+
}
743+
722744
/**
723745
* If grid allows export.s.
724746
*

0 commit comments

Comments
 (0)