class SAPO.Component.Table
Authors:
jose.p.dias AT co.sapo.pt
See also:
Version:
0.1
Since:
July 2011 requires SAPO.Dom.Css requires SAPO.Dom.Event requires if using default getters SAPO.Communication.Ajax CHECK OUT SAPO.Ink.Table, which offers a more updated component which the same purpose It comes bundled with a simple HTTP GET protocol to fetch data. One is able to override countGetter and pageGetter to support different scenarios (fully clientside, websockets...)
Deprecated:
Defined in Component/Table/0.1/lib.js

Constructor Summary
init (String|DomElement container, Object options)

Constructor Details

constructor init

init(String|DomElement container, Object options)
Parameters:
container (table)
options
  • String[] fields order of the column names. Fields not listed here are not displayed on the table.
  • [ String endpoint ] URI to server endpoint returning results for count and list operations. Required if pageGetter and countGetter missing.
  • [ Function(err, rows) pageGetter ] returns array of rows. See sample/tabledata.php to learn this protocol. Required if endpoint is missing (therefore discarding default AJAX implementation)
  • [ Function(err, count) countGetter ] returns number of items. See sample/tabledata.php to learn this protocol. Required if endpoint is missing (therefore discarding default AJAX implementation)
  • [ Object fieldNames ] object of optional translation strings for column names
  • [ Object formatters ] object of optional functions to format how cell is displayed
  • [ String orderBy ] field name to order results by. Default to undefined (no sorting).
  • [ String orderDir ] 1 (ascending) or -1 (descending). Defaults to 1.
  • [ String[] sortableFields ] list of fields which can be sorted. defaults to ['*'], i.e. all.
  • [ String cssURI ] URI to alternate CSS file for styling the slider. Set '' to skip CSS loading.
  • [ String method ] defaults to 'GET'. Method used to AJAX communication (ignored if pageGetter and countGetter are defined)
  • [ Number pageSize ] how many rows get fetched and displayed in each page. Defaults to 10.
  • [ Function(rowIdx, col, rowData, comp) onCellClicked ] called when a data cell is clicked. Returns coords, rowData and component (to the get comp.rows...)
  • [ Function(comp) onPageChanged ] called when page view changes. Returns component (to get all kinds of stuff: comp.rows, comp.options.*)