appendix_column.rst 4.12 KB
Newer Older
1
.. include:: hyperlinks.txt
2

3 4 5 6 7
.. _Appendix C:

Appendix C: Column configuration
===================================

LE GAC Renaud's avatar
LE GAC Renaud committed
8 9 10 11
Lists and 1-dim Metrics display a collection of columns.
The configuration properties of the columns are those of the
``Ext.grid.column.Column`` class. More information can be found in the ExtJS_
documentation.
12

LE GAC Renaud's avatar
LE GAC Renaud committed
13 14 15
The column is by default configured to render string. It is possible to handle
``boolean``, ``date`` and ``number`` values by changing the ``xtype`` property.
The mapping between the database field and the column types is the following:
16

LE GAC Renaud's avatar
LE GAC Renaud committed
17 18 19 20 21 22 23 24
        ================    =================
        Database            ``xtype``
        ================    =================
        boolean             ``booleancolumn``
        date / datetime     ``datecolumn``
        integer / float     ``numbercolumn``
        string (default)    ``gridcolumn``
        ================    =================
25

LE GAC Renaud's avatar
LE GAC Renaud committed
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
A column contains the value of the given database field. In that first case,
the mandatory properties depend on the report and are the following:

        ===============    ===============
        List               Metric1D
        ===============    ===============
        --                 ``aggregate``
        ``dbfield``        ``dbfield``
        ``text``           ``text``
        ===============    ===============

A column can also contains computed values obtained by applying a mathematical
expression on the cells of the other columns. In that second case, the mandatory
property are the following and do not depend on the report:

    .. list-table::

        * - **Computed column**
        * - ``eval``
        * - ``text``

The most important properties are defined in the next sections as a function of
the column type.

    .. note::

        The ``Metric1D`` columns are always rendered as ``numbercolumn``.
        Therefore the property ``xtype`` can be omitted.

Finally, the ExtJS_ library provide a special column numbering the rows
starting at one. It has only one configuration property:

    .. code:: javascript

        "xtype" : "rownumberer"

All columns
-----------
64

65 66 67 68 69 70 71
``align``
    the alignment of the column.
    Possible values are: ``"left"``, ``"center"``, and ``"right"``.

``columnWidth`` or ``flex``
    the column width can be specified as a number or a percentage.

LE GAC Renaud's avatar
LE GAC Renaud committed
72 73 74 75 76 77 78
``dataIndex``
    the index of the column used by the ``DataFrame``, the ``Ext.data.store``
    and the ``Ext.grid.Panel``. By default, this internal parameter is equal
    to the ``text`` property. However, when using the  ``eval`` property, it
    could be useful to index the column with short name like  *a*, *b*, ...

``dbfield``
79 80 81
    the address of the database field encoded as ``"tablename.fieldname"`` or
    ``"tablename.fieldname.keyname"``.

LE GAC Renaud's avatar
LE GAC Renaud committed
82 83 84 85 86 87 88 89 90
        .. warning::
            Do not use with the ``eval`` property.

``eval``
    the string defining the mathematical operation applied between column cells,
    *e.g* ``(a+b*2)/c`` where *a*, *b* and *c* are column indexes.

        .. warning::
            Do not use the ``dbfield`` and ``aggregate`` properties.
91 92 93 94 95 96

``hidden``
    the column is hidden when it is ``true``.

``renderer``
    A string pointing to the javascript function rendering the value or
LE GAC Renaud's avatar
LE GAC Renaud committed
97
    containing the function itself. The possible value is ``reprDuration``.
98

LE GAC Renaud's avatar
LE GAC Renaud committed
99
``text``
100 101
    the string containing the label of the column.

LE GAC Renaud's avatar
LE GAC Renaud committed
102
``xtype``
103 104 105
    the string specifying the type of the column.


LE GAC Renaud's avatar
LE GAC Renaud committed
106 107
Boolean column
--------------
108

109
``falseText``
LE GAC Renaud's avatar
LE GAC Renaud committed
110
    the string returns in the grid when the value is false.
111

112
``trueText``
LE GAC Renaud's avatar
LE GAC Renaud committed
113
    the string returns in the grid when the value is true.
114

LE GAC Renaud's avatar
LE GAC Renaud committed
115 116
Date column
-----------
117

118
``format``
LE GAC Renaud's avatar
LE GAC Renaud committed
119
    the format string, *e.g.* ``"d/m/Y"``.
120

LE GAC Renaud's avatar
LE GAC Renaud committed
121 122
Number column
-------------
123

LE GAC Renaud's avatar
LE GAC Renaud committed
124 125 126 127 128
``aggregate``
   the aggregation function uses by the 1-dim metric.
   Many functions are available: ``count``, ``max``, ``mean``,
   ``median``, ``min``, ``size``, ``std``, ``sum``, *etc*. In fact, all the
   descriptive stats methods of the DataFrame_ class.
129 130

``format``
LE GAC Renaud's avatar
LE GAC Renaud committed
131
    the format string, *e.g.* ``"0,000.00"``.
132 133

``summaryType``
LE GAC Renaud's avatar
LE GAC Renaud committed
134 135 136
    Summary are computed over the column values.
    Possible functions are ``"count"``, ``"sum"``, ``"min"``, ``"max"`` and
    ``"average"``.