Package s3 :: Module s3navigation :: Class S3ResourceHeader
[frames] | no frames]

Class S3ResourceHeader

source code

object --+
         |
        S3ResourceHeader

Simple Generic Resource Header for tabbed component views

Instance Methods
 
__init__(self, fields=None, tabs=None, title=None)
Constructor
source code
 
__call__(self, r, tabs=None, table=None, record=None, as_div=True)
Return the HTML representation of this rheader
source code
 
render_field(self, table, record, col)
Render an rheader field
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, fields=None, tabs=None, title=None)
(Constructor)

source code 

Constructor

@param fields: the fields to display, list of lists of
               fieldnames, Field instances or callables
@param tabs: the tabs
@param title: the title fieldname, Field or callable

Fields are specified in order rows->cols, i.e. if written
like:

[
    ["fieldA", "fieldF", "fieldX"],
    ["fieldB", None, "fieldY"]
]

then that's exactly the screen order. Row or column spans are
not supported - empty fields will be rendered as empty fields.
If you need to construct more complex rheaders, you should
implement a custom method.

Fields can be specified by field names, Field instances or
as callables. Where a field specifier is a callable, it will
be invoked with the record as parameter and is respected to
return the representation value.

Where a field specifier is a tuple of two items, the first
item is taken for the label (overriding the field label, if
any), like in:


[
    [(T("Name"), s3_fullname)],
    ...
]

Where the second item is a callable, it maybe necessary to
specify a label.

If you don't want any fields, specify this explicitly as:

    rheader = S3ResourceHeader(fields=[])

Where you don't specify any fields and the table contains a
"name" field, the rheader defaults to: [["name"]].

Overrides: object.__init__

__call__(self, r, tabs=None, table=None, record=None, as_div=True)
(Call operator)

source code 

Return the HTML representation of this rheader

Parameters:
  • r - the S3Request instance to render the header for
  • tabs - the tabs (overrides the original tabs definition)
  • table - override r.table
  • record - override r.record
  • as_div - True: will return the rheader_fields and the rheader_tabs together as a DIV False will return the rheader_fields and the rheader_tabs as a tuple (rheader_fields, rheader_tabs)

render_field(self, table, record, col)

source code 

Render an rheader field

Parameters:
  • table - the table
  • record - the record
  • col - the column spec (field name or tuple (label, fieldname))
Returns:
tuple (label, value)