Browse Source

Grid\Column::if 允许参数留空

jqh 4 years ago
parent
commit
540013574b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Grid/Column.php

+ 5 - 1
src/Grid/Column.php

@@ -280,8 +280,12 @@ class Column
      *
      * @return Column\Condition
      */
-    public function if(\Closure $condition)
+    public function if(\Closure $condition = null)
     {
+        $condition = $condition ?: function ($column) {
+            return $column->getValue();
+        };
+
         return $this->conditions[] = new Grid\Column\Condition($condition, $this);
     }