Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 557 Bytes

html-builder-macro.md

File metadata and controls

31 lines (23 loc) · 557 Bytes

Html Builder Macro

You can extend DataTables HTML Builder using macro.

Example macro:

use Yajra\DataTables\Html\Builder;
use Yajra\DataTables\Html\Column;

Builder::macro('addEditColumn', function () {
	$attributes = [
		'title'          => 'Edit',
		'data'           => 'edit',
		'name'           => '',
		'orderable'      => false,
		'searchable'     => false,
	];

	$this->collection->push(new Column($attributes));

	return $this;
});

Usage

$builder = new Builder;
$builder->addEditColumn()->ajax()->parameters([]);