Skip to content

Commit efe7aa1

Browse files
committed
Html builder docs.
1 parent 0668a2b commit efe7aa1

8 files changed

+136
-5
lines changed

documentation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
- [Builder](/docs/laravel-datatables/{{version}}/html-builder)
5353
- [Table](/docs/laravel-datatables/{{version}}/html-builder-table)
5454
- [Columns](/docs/laravel-datatables/{{version}}/html-builder-column)
55+
- [Ajax](/docs/laravel-datatables/{{version}}/html-builder-ajax)
5556
- [Parameters](/docs/laravel-datatables/{{version}}/html-builder-parameters)
5657
- [Events/Callbacks](/docs/laravel-datatables/{{version}}/html-builder-callbacks)
5758
- [Add Action](/docs/laravel-datatables/{{version}}/html-builder-action)
5859
- [Add Checkbox](/docs/laravel-datatables/{{version}}/html-builder-checkbox)
60+
- [Add Index](/docs/laravel-datatables/{{version}}/html-builder-index)
5961

6062
### PLUGINS
6163

html-builder-action.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# Html Builder Action Column
1+
# Html Builder Action Column
2+
3+
You can use `addAction` api for a quick adding of column with a pre-defined sets attibutes.
4+
Add action column is mostly used for creating a column that contains the `editing` options for your row.
5+
6+
The default attributes of action column are:
7+
```php
8+
[
9+
'defaultContent' => '',
10+
'data' => 'action',
11+
'name' => 'action',
12+
'title' => 'Action',
13+
'render' => null,
14+
'orderable' => false,
15+
'searchable' => false,
16+
'exportable' => false,
17+
'printable' => true,
18+
'footer' => '',
19+
];
20+
```

html-builder-ajax.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Html Builder Ajax
2+
3+
Ajax is an option that you set to tell `dataTable` where to fetch it's data.
4+
5+
See [datatables.net](https://datatables.net/) official documentation for [`ajax option`](https://datatables.net/reference/option/ajax) for details.
6+
7+
**Syntax**
8+
```php
9+
$builder->ajax($attributes);
10+
```
11+
12+
## Ajax Parameter
13+
Ajax parameter (`$attributes`) can either be a string or an array.
14+
15+
**String Attributes**
16+
17+
When the attribute passed is a `string`. The builder will treat this as the `URL` where we fetch our data.
18+
19+
```php
20+
$builder->ajax(route('users.data'));
21+
```
22+
23+
> {tip} Setting ajax to `null` or `empty string` will use the current url where Datatables was used.
24+
25+
**Array Attributes**
26+
27+
Accepted options are `url` and `data`.
28+
29+
```php
30+
$builder->ajax([
31+
'url' => route('users.index'),
32+
'type' => 'GET',
33+
'data' => 'function(d) { d.key = "value"; }',
34+
])
35+
```
36+
37+
### URL Option
38+
URL option represents the `url` where dataTables will fetch it's json data.
39+
40+
### Type Option
41+
Type option represents the type of request (`GET/POST`) that we will use when sending a request to the server.
42+
43+
### Data Option
44+
Data option is a `js` string that you can use to append custom data when sending the request to the server.
45+
46+
47+

html-builder-callbacks.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
# Html Builder Event Callbacks
1+
# Html Builder Event Callbacks
2+
3+
You can use a `js` string for each valid callback as documented on [`datatables.net`](https://datatables.net/reference/option/) callback options list.
4+
5+
## DataTables - Callbacks
6+
| Callback | Description |
7+
| --- | --- |
8+
|`createdRow` | Callback for whenever a TR element is created for the table's body. |
9+
|`drawCallback` | Function that is called every time DataTables performs a draw. |
10+
|`footerCallback` | Footer display callback function. |
11+
|`formatNumber` | Number formatting callback function. |
12+
|`headerCallback` | Header display callback function. |
13+
|`infoCallback` | Table summary information display callback. |
14+
|`initComplete` | Initialisation complete callback. |
15+
|`preDrawCallback` | Pre-draw callback. |
16+
|`rowCallback` | Row draw callback. |
17+
|`stateLoadCallback` | Callback that defines where and how a saved state should be loaded. |
18+
|`stateLoaded` | State loaded callback. |
19+
|`stateLoadParams` | State loaded - data manipulation callback |
20+
|`stateSaveCallback` | Callback that defines how the table state is stored and where. |
21+
|`stateSaveParams` | State save - data manipulation callbac |

html-builder-checkbox.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
# Html Builder Checkbox Column
1+
# Html Builder Checkbox Column
2+
3+
You can use `addCheckbox` api for a quick adding of column with a pre-defined sets attibutes.
4+
Add checkbox column is mostly used for creating a column that contains a checkbox `input`.
5+
6+
The default attributes of checkbox column are:
7+
```php
8+
[
9+
'defaultContent' => '<input type="checkbox" ' . $this->html->attributes($attributes) . '/>',
10+
'title' => $this->form->checkbox('', '', false, ['id' => 'dataTablesCheckbox']),
11+
'data' => 'checkbox',
12+
'name' => 'checkbox',
13+
'orderable' => false,
14+
'searchable' => false,
15+
'exportable' => false,
16+
'printable' => true,
17+
'width' => '10px',
18+
];
19+
```

html-builder-column.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Footer attribute will be as your `tables` column's `footer` content `<tfoot></tf
5252

5353
> {tip} To display the footer using html builder, pass `true` as 2nd argument on `$builder->table([], true)` api.
5454
55-
5655
### Exportable (Optional)
5756
Exportable attribute will flag the column to be included when `exporting` the table. Default value is `true`.
5857

html-builder-index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Html Builder Index Column
2+
3+
You can use `addIndex` api for a quick adding of column with a pre-defined sets attibutes.
4+
Add index column is mostly used for creating a column that contains a the internal index of the current record being displayed.
5+
6+
The default attributes of index column are:
7+
```php
8+
[
9+
'defaultContent' => '',
10+
'data' => 'DT_Row_Index',
11+
'name' => 'DT_Row_Index',
12+
'title' => '',
13+
'render' => null,
14+
'orderable' => false,
15+
'searchable' => false,
16+
'exportable' => false,
17+
'printable' => true,
18+
'footer' => '',
19+
];
20+
```
21+
22+
The `addIndex` api should be used along with [`addIndexColumn`](/docs/laravel-datatables/{{version}}/index-column) of `Datatables`.

html-builder-parameters.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# Html Builde Parameters
1+
# Html Builder Parameters
2+
3+
Parameters are basically the options you pass when declaring your `DataTable` js script.
4+
5+
See the [`datatables.net`](https://datatables.net) official documentation for the list of all possible [`options`](https://datatables.net/reference/option/).

0 commit comments

Comments
 (0)