Skip to content

Commit

Permalink
Merge pull request #3900 from lixu521/feature/define_empty_page
Browse files Browse the repository at this point in the history
grid默认空模版支持自定义是否显示
  • Loading branch information
z-song committed Sep 27, 2019
2 parents c8439b3 + 1d596c9 commit b12d012
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/grid/table.blade.php
Expand Up @@ -41,7 +41,7 @@

<tbody>

@if($grid->rows()->isEmpty())
@if($grid->rows()->isEmpty() && $grid->showDefineEmptyPage())
@include('admin::grid.empty-grid')
@endif

Expand Down
21 changes: 21 additions & 0 deletions src/Grid.php
Expand Up @@ -154,6 +154,7 @@ class Grid
'show_row_selector' => true,
'show_create_btn' => true,
'show_column_selector' => true,
'show_define_empty_page' => true,
];

/**
Expand Down Expand Up @@ -736,6 +737,26 @@ public function disableCreateButton(bool $disable = true)
return $this->option('show_create_btn', !$disable);
}

/**
* Remove define empty page on grid.
*
* @return $this
*/
public function disableDefineEmptyPage(bool $disable = true)
{
return $this->option('show_define_empty_page', !$disable);
}

/**
* If grid show define empty page on grid.
*
* @return bool
*/
public function showDefineEmptyPage()
{
return $this->option('show_define_empty_page');
}

/**
* If allow creation.
*
Expand Down

0 comments on commit b12d012

Please sign in to comment.