File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 6666 - [Builder](/docs/{{package}}/{{version}}/html-builder)
6767 - [Table](/docs/{{package}}/{{version}}/html-builder-table)
6868 - [Columns](/docs/{{package}}/{{version}}/html-builder-column)
69+ - [Macro](/docs/{{package}}/{{version}}/html-builder-macro)
6970 - [Ajax](/docs/{{package}}/{{version}}/html-builder-ajax)
7071 - [Parameters](/docs/{{package}}/{{version}}/html-builder-parameters)
7172 - [Events/Callbacks](/docs/{{package}}/{{version}}/html-builder-callbacks)
Original file line number Diff line number Diff line change 1+ # Html Builder Macro
2+
3+ You can extend DataTables HTML Builder using ` macro ` .
4+
5+ ## Example macro:
6+ ``` php
7+ use Yajra\Datatables\Html\Builder;
8+ use Yajra\Datatables\Html\Column;
9+
10+ Builder::macro('addEditColumn', function () {
11+ $attributes = [
12+ 'title' => 'Edit',
13+ 'data' => 'edit',
14+ 'name' => '',
15+ 'orderable' => false,
16+ 'searchable' => false,
17+ ];
18+
19+ $this->collection->push(new Column($attributes));
20+
21+ return $this;
22+ });
23+
24+ ```
25+
26+ ## Usage
27+ ``` php
28+ $builder = new Builder;
29+ $builder->addEditColumn()->ajax()->parameters([]);
30+
31+ ```
Original file line number Diff line number Diff line change 44
55Run the following command in your project to get the latest version of the plugin:
66
7- ` composer require yajra/laravel-datatables-html:^1 .0 `
7+ ` composer require yajra/laravel-datatables-html:^2 .0 `
88
99Open the file ``` config/app.php ``` and then add following service provider.
1010
You can’t perform that action at this time.
0 commit comments