Skip to content

Commit b93b741

Browse files
author
Steffen
committed
ajax url is required
1 parent d328947 commit b93b741

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Resources/doc/setup.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ function order() {
260260

261261
## 7. Ajax
262262

263-
| Option | Type | Default |
264-
|------ |--------|---------|
265-
| url | string | '' |
266-
| type | string | 'GET' |
267-
| pipeline | int | 0 |
263+
| Option | Type | Default | |
264+
|------ |--------|---------|----------|
265+
| url | string | | required |
266+
| type | string | 'GET' | |
267+
| pipeline | int | 0 | |
268268

269269
## 8. Name
270270
Since the datatable class should extend the ``AbstractDatatableView`` and this one implements ``DatatableViewInterface``, a ``getName`` method is required. The returned value **must only include letters, numbers, underscores or dashes** as it will be a seed for the id of the generated container of the datatable.

Twig/DatatableTwigExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ private function getOptions(AbstractDatatableView $datatable)
105105
$options['view_callbacks'] = $datatable->getCallbacks();
106106
$options['view_events'] = $datatable->getEvents();
107107
$options['view_columns'] = $datatable->getColumnBuilder()->getColumns();
108+
109+
if ('' === $datatable->getAjax()->getUrl()) {
110+
throw new Exception('getOptions(): Specify an ajax url.');
111+
}
112+
108113
$options['view_ajax'] = $datatable->getAjax();
109114

110115
$options['view_multiselect'] = $datatable->getColumnBuilder()->isMultiselect();

0 commit comments

Comments
 (0)