Bläddra i källkod

增加 Grid::dropColumn 方法

jqh 4 år sedan
förälder
incheckning
8edae7b93f
1 ändrade filer med 19 tillägg och 0 borttagningar
  1. 19 0
      src/Grid.php

+ 19 - 0
src/Grid.php

@@ -308,6 +308,25 @@ class Grid
         return $this->allColumns;
     }
 
+    /**
+     * 删除列.
+     *
+     * @param string|Column $column
+     *
+     * @return $this
+     */
+    public function dropColumn($column)
+    {
+        if ($column instanceof Column) {
+            $column = $column->getName();
+        }
+
+        $this->columns->offsetUnset($column);
+        $this->allColumns->offsetUnset($column);
+
+        return $this;
+    }
+
     /**
      * Add column to grid.
      *