summaryrefslogtreecommitdiff
path: root/doc/source/ref/tables.rst
blob: 4b74d5e35fbd63d26311053722c52fc10f5c4f6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
==================
Horizon DataTables
==================

.. module:: 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:

.. autoclass:: DataTable
    :members:

DataTable Options
=================

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

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

.. autoclass:: horizon.tables.base.DataTableOptions
    :members:

Table Components
================

.. autoclass:: Column
    :members:

.. autoclass:: Row
    :members:

Actions
=======

.. autoclass:: Action
    :members:

.. autoclass:: LinkAction
    :members:

.. autoclass:: FilterAction
    :members:

.. autoclass:: BatchAction
    :members:

.. autoclass:: DeleteAction
    :members:

Class-Based Views
=================

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

.. autoclass:: DataTableView

.. autoclass:: MultiTableView