Skip to content

Commit b15fe70

Browse files
author
Steve Schütze
committed
fix overwriting the given options from bootstrap tables
1 parent 94f503d commit b15fe70

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/Widgets/BootstrapTable.php

+10-16
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function setTableOptions(): array
7575
$settings['data-locale'] = Yii::$app->language;
7676
}
7777

78-
return $this->tableOptions = array_merge($this->tableOptions, $settings);
78+
return $this->tableOptions = array_merge($settings, $this->tableOptions);
7979
}
8080

8181
public function run(): string
@@ -88,7 +88,6 @@ public function run(): string
8888
public function renderTableHeader(): string
8989
{
9090
$html = [];
91-
9291
if ($this->rowCheckboxSelect) {
9392
$html[] = $this->addColumnCheckboxSelect();
9493
}
@@ -133,22 +132,17 @@ private function renderTableHeaderCell($cell): string
133132
private function setHeaderOptions($column)
134133
{
135134
$columnClass = (new ReflectionClass($column))->getShortName();
136-
switch ($columnClass) {
137-
case 'ActionColumn':
138-
$column->headerOptions = [
139-
'data-field' => 'action',
140-
'data-filter-control' => 'false',
141-
'data-searchable' => 'false',
142-
'data-sortable' => 'false',
143-
'data-switchable' => 'false',
144-
];
145-
break;
135+
if ('ActionColumn' === $columnClass) {
136+
$column->headerOptions = [
137+
'data-field' => 'action',
138+
'data-filter-control' => 'false',
139+
'data-searchable' => 'false',
140+
'data-sortable' => 'false',
141+
'data-switchable' => 'false',
142+
];
146143
}
147144

148-
$column->headerOptions = array_merge(
149-
self::$defaultHeaderOptions,
150-
$column->headerOptions
151-
);
145+
$column->headerOptions = array_merge(self::$defaultHeaderOptions, $column->headerOptions);
152146

153147
return $column;
154148
}

0 commit comments

Comments
 (0)