tuskar-ui/docs/source/ref/tables.rst
Gabriel Hurley 753ebd673c Moved ajax updating from Action to Row.
This fixes the problem of having to "hide" the update action
in the row's actions column. Fixes bug 948397.

Additionally, added some protection for spillover between
the attrs dictionary on action instances. Fixes bug 954592.

FWIW, the code involved in the AJAX updating is largely identical,
it's just been moved from Action to Row and had few data accessors
renamed to account for the differing relation to Table and Row.
This also allowed the javascript to be significantly cleaner.

Change-Id: Ic8932a33ca6956a56c8eee09bb0a4d1f59e0ab3a
2012-03-13 17:44:07 -07: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

FilterAction

BatchAction

DeleteAction

Class-Based Views

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

DataTableView

MultiTableView