Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b44654

Browse files
authored
Merge pull requestyajra#55 from karmendra/addCheckbox
Add parameter in addCheckbox to prepend or append the checkbox column
2 parentsacb4276 +1b0a288 commit2b44654

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/Html/Builder.php‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,10 @@ public function getQualifiedTitle($title)
403403
* Add a checkbox column.
404404
*
405405
* @param array $attributes
406+
* @param bool|int $position true to prepend, false to append or a zero-based index for positioning
406407
* @return $this
407408
*/
408-
publicfunctionaddCheckbox(array$attributes = [])
409+
publicfunctionaddCheckbox(array$attributes = [],$position =false)
409410
{
410411
$attributes =array_merge([
411412
'defaultContent' =>'<input type="checkbox"' .$this->html->attributes($attributes) .'/>',
@@ -418,7 +419,15 @@ public function addCheckbox(array $attributes = [])
418419
'printable' =>true,
419420
'width' =>'10px',
420421
],$attributes);
421-
$this->collection->push(newColumn($attributes));
422+
$column =newColumn($attributes);
423+
424+
if ($position ===true) {
425+
$this->collection->prepend($column);
426+
}elseif ($position ===false ||$position >=$this->collection->count()) {
427+
$this->collection->push($column);
428+
}else {
429+
$this->collection->splice($position,0, [$column]);
430+
}
422431

423432
return$this;
424433
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp