Browse Source

移除Grid::pagination()方法;移除禁止分页时展示的默认页脚信息

jqh 4 years ago
parent
commit
b80b711c91
2 changed files with 6 additions and 34 deletions
  1. 5 13
      resources/views/grid/table-pagination.blade.php
  2. 1 21
      src/Grid/Concerns/HasPaginator.php

+ 5 - 13
resources/views/grid/table-pagination.blade.php

@@ -1,13 +1,5 @@
-@if ($grid->allowPagination())
-    <div class="box-footer d-block clearfix ">
-        {!! $grid->paginator()->render() !!}
-    </div>
-@else
-    <div class="box-footer d-block clearfix text-80 " style="height:48px;line-height:25px;">
-        @if ($grid->rows()->isEmpty())
-            {!! trans('admin.pagination.range', ['first' => '<b>0</b>', 'last' => '<b>'.$grid->rows()->count().'</b>', 'total' => '<b>'.$grid->rows()->count().'</b>',]) !!}
-        @else
-            {!! trans('admin.pagination.range', ['first' => '<b>1</b>', 'last' => '<b>'.$grid->rows()->count().'</b>', 'total' => '<b>'.$grid->rows()->count().'</b>',]) !!}
-        @endif
-    </div>
-@endif
+@if ($grid->allowPagination())
+    <div class="box-footer d-block clearfix ">
+        {!! $grid->paginator()->render() !!}
+    </div>
+@endif

+ 1 - 21
src/Grid/Concerns/HasPaginator.php

@@ -3,6 +3,7 @@
 namespace Dcat\Admin\Grid\Concerns;
 
 use Dcat\Admin\Grid\Tools;
+use Dcat\Admin\Support\Helper;
 
 trait HasPaginator
 {
@@ -30,11 +31,6 @@ trait HasPaginator
      */
     protected $paginatorClass = Tools\Paginator::class;
 
-    /**
-     * @var \Closure
-     */
-    protected $paginationCallback;
-
     /**
      * Paginate the grid.
      *
@@ -69,18 +65,6 @@ trait HasPaginator
         return $this;
     }
 
-    /**
-     * @param \Closure
-     *
-     * @return $this
-     */
-    public function pagination(\Closure $callback)
-    {
-        $this->paginationCallback = $callback;
-
-        return $this;
-    }
-
     /**
      * Get the grid paginator.
      *
@@ -160,10 +144,6 @@ trait HasPaginator
      */
     public function renderPagination()
     {
-        if ($callback = $this->paginationCallback) {
-            return $callback($this);
-        }
-
         return view('admin::grid.table-pagination', ['grid' => $this]);
     }
 }