Skip to content

Commit 638ab60

Browse files
committed
Add some docs for the clientside integration
1 parent a239a13 commit 638ab60

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

docs/source/index.html.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,30 @@ argument which is passed to the type class for parametrized instantiation.
483483

484484
# Javascript
485485

486-
TBD.
486+
```javascript
487+
$('#table1').initDataTables({{ datatable_settings(datatable1) }}, {
488+
searching: true,
489+
dom:'<"html5buttons"B>lTfgitp',
490+
buttons: [
491+
'copy',
492+
{ extend: 'pdf', title: 'domains'},
493+
{ extend: 'print' }
494+
]
495+
}).then(function(dt) {
496+
// dt contains the initialized instance of DataTables
497+
dt.on('draw', function() {
498+
alert('Redrawing table');
499+
})
500+
});
501+
```
502+
During the quickstart we introduced the `initDataTables` Javascript function, taking the serverside
503+
settings as its argument. The function takes an optional second argument, which is merged into the
504+
serverside settings to override any template-specific changes, but as this is executed in the browser
505+
it also means this is where you can add Javascript events according to DataTables documentation.
506+
507+
The function returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
508+
which is fulfilled with the `DataTables` instance once initialization is completed. This allows you
509+
all the flexibility you could need to [invoke API functions](https://datatables.net/reference/api/).
487510

488511
# Legal
489512

0 commit comments

Comments
 (0)