Package turbogears :: Package widgets :: Module datagrid :: Class DataGrid

Class DataGrid

source code

Widget --+
         |
        DataGrid

Generic widget to present and manipulate data in a grid (tabular) form.

The columns to build the grid from are specified with fields ctor argument which is a list. Currently an element can be either a two-element tuple or instance of DataGrid.Column class. If tuple is used it a Column is then build out of it, first element is assumed to be a title and second element - field accessor.

You can specify columns' data statically, via fields ctor parameter, or dynamically, by via 'fields' key.

Nested Classes
  Column
Simple struct that describes single DataGrid column.
  attrwrapper
Helper class that returns an object's attribute when called.
Instance Methods
 
__init__(self, fields=None, **kw) source code
 
get_column(self, name)
Return DataGrid.Column with specified name.
source code
 
__getitem__(self, name)
Shortcut to get_column.
source code
 
update_params(self, d) source code
Static Methods
 
get_field_getter(columns)
Return a function to access the fields of table by row, col.
source code
Class Variables
  css = [CSSLink(static, "grid.css")]
  template = "turbogears.widgets.templates.datagrid"
  fields = None
hash(x)
Method Details

get_column(self, name)

source code 

Return DataGrid.Column with specified name.

Raises KeyError if no such column exists.