فهرست منبع

增加allowHeader方法

Jiang qinghua 6 سال پیش
والد
کامیت
93f4fbe5e5
2فایلهای تغییر یافته به همراه23 افزوده شده و 2 حذف شده
  1. 1 2
      resources/views/grid/table.blade.php
  2. 22 0
      src/Grid.php

+ 1 - 2
resources/views/grid/table.blade.php

@@ -1,5 +1,4 @@
-@if ($grid->option('show_toolbar')
-    && ($grid->getTools()->has() || $grid->allowExportBtn() || $grid->allowCreateBtn() || $grid->allowQuickCreateBtn() || $grid->allowResponsive() || !empty($title)))
+@if ($grid->allowHeader())
     <div class="box-header " >
         @if(!empty($title))
             <h4 class="pull-left" style="margin:5px 10px 0;">

+ 22 - 0
src/Grid.php

@@ -254,6 +254,28 @@ class Grid
         return $this->responsive ? true : false;
     }
 
+    /**
+     * @return bool
+     */
+    public function allowHeader()
+    {
+        if (
+            $this->option('show_toolbar')
+            && (
+                $this->getTools()->has() ||
+                $this->allowExportBtn() ||
+                $this->allowCreateBtn() ||
+                $this->allowQuickCreateBtn() ||
+                $this->allowResponsive() ||
+                !empty($this->variables['title'])
+            )
+        ) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * Setup grid tools.
      */