Horizon DataTables

Horizon DataTables

Horizon includes a componentized API for programmatically creating tables in the UI. Why would you want this? It means that every table renders correctly and consistently, table-level and row-level actions all have a consistent API and appearance, and generally you don’t have to reinvent the wheel or copy-and-paste every time you need a new table!

See also

For usage information, tips & tricks and more examples check out the DataTables Topic Guide.

DataTable

The core class which defines the high-level structure of the table being represented. Example:

class MyTable(DataTable):
    name = Column('name')
    email = Column('email')

    class Meta(object):
        name = "my_table"
        table_actions = (MyAction, MyOtherAction)
        row_actions = (MyAction)

A full reference is included below:

DataTable Options

The following options can be defined in a Meta class inside a DataTable class. Example:

class MyTable(DataTable):
    class Meta(object):
        name = "my_table"
        verbose_name = "My Table"

FormsetDataTable

You can integrate the DataTable with a Django Formset using one of following classes:

Table Components

Actions

Class-Based Views

Several class-based views are provided to make working with DataTables easier in your UI.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.