tuskar-ui/docs/source/ref/tables.rst
Gabriel Hurley 95970b701c Auto-updating for data in data tables!
This adds a few layers of functionality:

  * Support for preemptive actions that run before data
    is loaded into the table (saving on API calls).
  * "Update" actions that fetch new data for specific rows.
  * Automatic AJAX polling for rows which are in an "unknown" state.

The table/action changes were accomplished without breaking any existing tests.
Also includes unit tests to verify the new behavior.
Lastly, includes a big chunk of new docs to begin flashing out topic guides
and examples for working with Horizon beyond just an API reference.

Change-Id: Ifd15919066825d7269bbe4efcb4d51b8ed19baed
2012-02-08 22:23:46 -08:00

1.7 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- 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!

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:
        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:
        name = "my_table"
        verbose_name = "My Table"

horizon.tables.base.DataTableOptions

Table Components

Column

Row

Actions

Action

LinkAction

UpdateAction

FilterAction

BatchAction

DeleteAction

Class-Based Views

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

DataTableView

MultiTableView