Skip to content

Commit 6555c25

Browse files
committed
Add parameter in addCheckbox to prepend or append the checkbox column
Add parameter in addCheckbox to prepend or append the checkbox column.
1 parent 8b7448f commit 6555c25

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Html/Builder.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,10 @@ public function getQualifiedTitle($title)
460460
* Add a checkbox column.
461461
*
462462
* @param array $attributes
463+
* @param bool $prependColumn
463464
* @return $this
464465
*/
465-
public function addCheckbox(array $attributes = [])
466+
public function addCheckbox(array $attributes = [], bool $prependColumn = false)
466467
{
467468
$attributes = array_merge([
468469
'defaultContent' => '<input type="checkbox" ' . $this->html->attributes($attributes) . '/>',
@@ -475,7 +476,12 @@ public function addCheckbox(array $attributes = [])
475476
'printable' => true,
476477
'width' => '10px',
477478
], $attributes);
478-
$this->collection->push(new Column($attributes));
479+
480+
if($prependColumn) {
481+
$this->collection->prepend(new Column($attributes));
482+
} else {
483+
$this->collection->push(new Column($attributes));
484+
}
479485

480486
return $this;
481487
}

0 commit comments

Comments
 (0)