@@ -403,10 +403,10 @@ public function getQualifiedTitle($title)
403
403
* Add a checkbox column.
404
404
*
405
405
* @param array $attributes
406
- * @param bool $position
406
+ * @param bool|int $position true to prepend, false to append or a zero-based index for positioning
407
407
* @return $this
408
408
*/
409
- public function addCheckbox (array $ attributes = [], bool $ position = false )
409
+ public function addCheckbox (array $ attributes = [], $ position = false )
410
410
{
411
411
$ attributes = array_merge ([
412
412
'defaultContent ' => '<input type="checkbox" ' . $ this ->html ->attributes ($ attributes ) . '/> ' ,
@@ -419,14 +419,14 @@ public function addCheckbox(array $attributes = [], bool $position = false)
419
419
'printable ' => true ,
420
420
'width ' => '10px ' ,
421
421
], $ attributes );
422
-
423
- if ($ position === true ) {
424
- $ this ->collection ->prepend ($ column );
425
- } else if ($ position === false || $ position >= $ this ->collection ->count ()) {
426
- $ this ->collection ->push ($ column );
427
- } else {
428
- $ this ->collection ->splice ($ position , 0 , [$ column ]);
429
- }
422
+ $ column = new Column ( $ attributes );
423
+ if ($ position === true ) {
424
+ $ this ->collection ->prepend ($ column );
425
+ } else if ($ position === false || $ position >= $ this ->collection ->count ()) {
426
+ $ this ->collection ->push ($ column );
427
+ } else {
428
+ $ this ->collection ->splice ($ position , 0 , [$ column ]);
429
+ }
430
430
431
431
return $ this ;
432
432
}
0 commit comments