File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments