Package s3 :: Module s3grouped :: Class S3GroupedItemsTable
[frames] | no frames]

Class S3GroupedItemsTable

source code

object --+
         |
        S3GroupedItemsTable

Helper class to render representations of a grouped items report

Instance Methods
 
__init__(self, resource, title=None, data=None, aggregate=None, field_types=None, group_headers=False, totals_label=None, pdf_header=DEFAULT, pdf_footer=None)
Constructor
source code
 
html(self)
Produce a HTML representation of the grouped table
source code
 
pdf(self, r, filename=None)
Produce a PDF representation of the grouped table
source code
 
xls(self, r, filename=None)
Produce an XLS sheet of the grouped table
source code
 
xls_group_data(self, rows, group, level=0)
Append a group to the XLS data
source code
 
xls_group_header(self, rows, group, level=0)
Render the group header (=group label)
source code
 
xls_group_footer(self, rows, group, level=0)
Append a group footer to the XLS data
source code
 
xls_table_footer(self, rows)
Render the table footer
source code
 
xls_item_data(self, rows, item, level=0)
Append an item to the XLS data
source code
 
html_render_table_header(self, table)
Render the table header
source code
 
html_render_table_footer(self, table)
Render the table footer
source code
 
html_render_group(self, tbody, group, level=0)
Render a group of rows
source code
 
html_render_group_header(self, tbody, group, level=0)
Render the group header (=group label)
source code
 
html_render_group_footer(self, tbody, group, level=0)
Render the group footer (=group totals)
source code
 
html_render_item(self, tbody, item, level=0)
Render an item
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, resource, title=None, data=None, aggregate=None, field_types=None, group_headers=False, totals_label=None, pdf_header=DEFAULT, pdf_footer=None)
(Constructor)

source code 

Constructor

Parameters:
  • resource - the resource
  • title - the report title
  • data - the JSON data (as dict)
  • aggregate - the aggregation functions as list of tuples (method, colname)
  • field_types - the field types as dict {colname: type}
  • group_headers - render group header rows
  • totals_label - the label for the aggregated rows (default: "Total")
  • pdf_header - callable or static HTML to use as document header, function(r, title=title)
  • pdf_footer - callable or static HTML to use as document footer, function(r)
Overrides: object.__init__

html(self)

source code 

Produce a HTML representation of the grouped table

Returns:
a TABLE instance

pdf(self, r, filename=None)

source code 

Produce a PDF representation of the grouped table

Parameters:
  • r - the S3Request
Returns:
the PDF document

xls(self, r, filename=None)

source code 

Produce an XLS sheet of the grouped table

Parameters:
  • r - the S3Request
Returns:
the XLS document

xls_group_data(self, rows, group, level=0)

source code 

Append a group to the XLS data

Parameters:
  • rows - the XLS rows array to append to
  • group - the group dict
  • level - the grouping level

xls_group_header(self, rows, group, level=0)

source code 

Render the group header (=group label)

Parameters:
  • row - the XLS rows array to append to
  • group - the group dict
  • level - the grouping level

xls_group_footer(self, rows, group, level=0)

source code 

Append a group footer to the XLS data

Parameters:
  • rows - the XLS rows array to append to
  • group - the group dict
  • level - the grouping level

xls_table_footer(self, rows)

source code 

Render the table footer

Parameters:
  • table - the TABLE instance

xls_item_data(self, rows, item, level=0)

source code 

Append an item to the XLS data

Parameters:
  • rows - the XLS rows array to append to
  • item - the item dict
  • level - the grouping level

html_render_table_header(self, table)

source code 

Render the table header

Parameters:
  • table - the TABLE instance

html_render_table_footer(self, table)

source code 

Render the table footer

Parameters:
  • table - the TABLE instance

html_render_group(self, tbody, group, level=0)

source code 

Render a group of rows

Parameters:
  • tbody - the TBODY or TABLE to append to
  • group - the group dict
  • level - the grouping level

html_render_group_header(self, tbody, group, level=0)

source code 

Render the group header (=group label)

Parameters:
  • tbody - the TBODY or TABLE to append to
  • group - the group dict
  • level - the grouping level

html_render_group_footer(self, tbody, group, level=0)

source code 

Render the group footer (=group totals)

Parameters:
  • tbody - the TBODY or TABLE to append to
  • group - the group dict
  • level - the grouping level

html_render_item(self, tbody, item, level=0)

source code 

Render an item

Parameters:
  • tbody - the TBODY or TABLE to append to
  • item - the item dict
  • level - the grouping level