Doug Hellmann 259746bcff rearrange content into the new standard layout
Change-Id: I6dbe0ea81d9d21a0f92d270337637606220f38d1
Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-15 17:40:10 -04:00

2.2 KiB

Horizon DataTables

horizon.tables

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!

For usage information, tips & tricks and more examples check out the topics-datatables.

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

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"

horizon.tables.base.DataTableOptions

FormsetDataTable

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

horizon.tables.formset.FormsetDataTableMixin

horizon.tables.formset.FormsetDataTable

Table Components

Column

Row

Actions

Action

LinkAction

FilterAction

FixedFilterAction

BatchAction

DeleteAction

UpdateAction

Class-Based Views

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

DataTableView

MultiTableView