Skip to content

Commit ec30459

Browse files
committed
Added optional merge of config raw columns to rawColumns method
1 parent 3875123 commit ec30459

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/DataTableAbstract.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,26 @@ public function escapeColumns($columns = '*')
249249
/**
250250
* Set columns that should not be escaped.
251251
*
252+
* Optionally merge the defaults from config
253+
*
252254
* @param array $columns
255+
* @param bool $merge
253256
* @return $this
254257
*/
255-
public function rawColumns(array $columns)
258+
public function rawColumns(array $columns, $merge = false)
256259
{
257-
$this->columnDef['raw'] = $columns;
260+
if ($merge) {
261+
$config = $this->config->get('datatables.columns');
262+
263+
$this->columnDef['raw'] = array_merge($config['raw'], $columns);
264+
} else {
265+
$this->columnDef['raw'] = $columns;
266+
}
258267

259268
return $this;
260269
}
261270

271+
262272
/**
263273
* Sets DT_RowClass template.
264274
* result: <tr class="output_from_your_template">.

0 commit comments

Comments
 (0)