Module reahl.web.datatable

Displaying tabular data in a paged, sortable manner


class reahl.web.datatable.DataTable(view, columns, items, items_per_page=10, caption_text=None, summary=None, page_menu_layout=None, css_id=None)

A table containing a potentially large set of data items. DataTable does not display all its items on the current page. It renders as a table spread over different pages between which a user can navigate, thus preventing a large data set sent back to a single page.

If a DynamicColumn is used to define the table also specifies a sort_key, the table is rendered with controls on that column heading that allows it to be sorted on that column. The sort operation applies to the entire dataset even though the user stays on the current page and only sees a subset of that data.

  • view – (See reahl.web.fw.Widget)
  • columns – The reahl.web.ui.DynamicColumn instances that define the contents of the table.
  • items – A list containing objects represented in each row of the table.
  • items_per_page – The maximum number of rows allowed per page.
  • caption_text – If given, a reahl.web.ui.Caption is added with this text.
  • summary – If given, this text will be set as the summary of the table (See Table).
  • page_menu_layout – A MenuLayout to use for this table’s PageMenu.
  • css_id – (See HTMLElement)

Changed in version 3.2: Added the page_menu_layout keyword argument.