class SAPO.Ink.Table
Authors:
jose.p.dias AT co.sapo.pt
Version:
0.1
 Shows data as table.
 Supports sorting and pagination either on the
 client-side (if model is supplied) or server-side (if endpoint responding according to the "spec" is supplied).
 Pagination is optional (pass on the pageSize option).
 It passed, a Pagination component is instanced on the pagionation option or immediately after the table (if pagination is ommitted).
 The columns displayed and their order are defined in the fields option. Your object can have more than these fields, they simply won't appear.
 Fieldnames allows one to define custom column names.
 SortableFields allows one to choose which columns can be sortable. By default none is. Use '*' to allow all, otherwise pass an array of fields.
 Formatters allows custom display of cells. At the function call only the table cell is set, no content or classes.
 There are callback for
 
references: http://workshop.andr3.net/datatables/ http://tantek.com/presentations/2012/09/microformats2/ http://www.w3.org/TR/WCAG20-TECHS/H43
Since:
October 2012
Defined in Ink/Table/0.1/lib.js

Constructor Summary
Table (String|DOMElement selector, Object options)

Function Summary
unregisters the component and removes its markup from the DOM
returns a copy of the model
Object[] getVisibleItems()
returns the array of visible items
refreshes the content of the table
updates the model. only valid if model was used before, not endpoint!

Constructor Details

constructor Table

Table(String|DOMElement selector, Object options)
Parameters:
selector
options
  • [ Object[] model ] the model to use, for client-side data. either this option or model _must be provided_
  • [ String endpoint ] an URI to use to get list and count information, for server-side data. either this option or model _must be provided_
  • String[] fields fields to display on the table
  • [ Object fieldNames ] column names to display on the table. if ommitted
  • [ Object formatters ] optional hash of field -> formatter fn. formatter receives (fieldValue, item, tdEl)
  • [ String[]|String sortableFields ] by default no columns support sorting. if you want all columns to be sortable pass '*', otherwise pass an array of fields
  • [ Number pageSize ] if defined, pagination is applied
  • [ Function(SAPO.Ink.Table, Object) onHeaderClick ] callback that gets called when the user clicks on a column header. Relevant data is passed on the object o.
  • [ Function(SAPO.Ink.Table, Object) onCellClick ] callback that gets called when the user clicks on a cell. Relevant data is passed on the object o.

Function Details

function destroy

destroy()
unregisters the component and removes its markup from the DOM

function getModel

String[] getModel()
returns a copy of the model

function getVisibleItems

Object[] getVisibleItems()
returns the array of visible items

function refresh

refresh()
refreshes the content of the table

function setModel

setModel()
updates the model. only valid if model was used before, not endpoint!