django-datatable-view Documentation, Release 0.9
class MyDatatableView(DatatableView):
datatable_class = MyDatatable
An alternate abbreviated style is available: as with class-based views that use Django forms, you can set these Meta
attributes directly on the view class, shown in more detail here. Please note that if you’re declaring anything fancier
than simple model fields or methods as columns (typically anything that would have required the 2-tuple or 3-tuple
column syntax), please use the new Datatable object strategy.
The new Datatable object doubles as the old 0.8 DatatableOptions template renderable ob-
ject. DatatableOptions and utils.get_datatable_structure() have both been removed, since
Datatable itself is all you need.
New vocabulary
Celebrate We’re becoming more sophisticated!
Now that we spent a bunch of time learning how to use the tools we created, it felt like a good time to change some of
the terms used internally.
In connection with the new Datatable object that helps you design the datatable, we’ve started referring to
column data callbacks as “processors”. This means that we will stop relying on callbacks in the documentation being
named in the pattern of ’get_column_FOO_data()’. Instead, you’ll notice names like ’get_FOO_data()’,
and we’ll be specifying the callback in a column definition via a processor keyword argument. See Postprocessors
for a examples of this.
No more automatic column callbacks
The Zen of Python Explicit is better than implicit.
We knew that implicit callbacks was a bad idea, but in our defense, the deprecated column format was really cumber-
some to use, and implicit callbacks were saving us some keystrokes. This behavior is going away in version 1.0. We
continue to support implicit callbacks so that 0.9 is a backwards-compatible release with 0.8. If you have any column
callbacks (we’re calling them “processors” now) that aren’t explicitly named in the column definition, please update
your code soon!
No more automatic dataTables.js initialization
Note Bye bye function confirm_datatable_options(options){ ... }
Automatic initialization has gone the way of the buffalo, meaning that it doesn’t exist anymore. The global JavaScript
function confirm_datatable_options only ever existed because auto initialization took away your chance to
set custom options during the init process. You should initialize your datatables via a simple call to the global function
datatableview.initialize($(’.datatable’), opts). This JS function reads DOM attributes from
the table structure and builds some of the column options for you, but you can pass literally any other supported option
in as the second argument. Just give it an object, and everything will be normal.
There is a configurable Javascript flag datatableview.auto_initialize that previously defaulted to true,
but in 0.9 its default value is now false. If you need 0.9 to behave the way it did in 0.8, set this flag globally or
per-page as needed. (Be careful not to do it in a $(document).ready() handler, since auto initialization runs
during that hook. You might end up flagging for auto initialization after datatableview.js has already finished checking
it, and nothing will happen.)
4 Chapter 1. 0.9 Migration Guide