Version 1.7 glow.widgets.Timetable.Track
API Quick Reference
JavaScript is required to use the quick reference
A Track is a grouping of Timetable items.
Constructor
A Track cannot be directly instantiated. Instead the addTrack method of glow.widgets.Timetable must be used.
Properties
- data
-
The track's arbitrary data store
- Type
- disabled
-
Should the Track be removed from the view?
- Type
Description
If set to true, this Track will not be rendered in the Timetable view the next time it is drawn/redrawn
- id
-
The Track's id
- Type
- items
-
an array of the Track's Items in order of their start time
- Type
- Item[]
- size
-
The Track's size
- Type
- timetable
-
The Track's parent Timetable
- title
-
The Track's title
- Type
Methods
- addItem
-
Factory method for creating an Item and adding it to the Track
Synopsis
myTrack.addItem(title, start, end, opts);
Parameters
- title
-
- Type
The title
- start
-
- Type
- |
The start point
- end
-
- Type
- |
The end point
- opts
-
- Type
- Optional
- Yes
Options object
- className
-
A class name for the Item's container element
- Type
- Optional
- Yes
- data
-
An object of arbitrary data to be attached to the Item
- Type
- Optional
- Yes
- id
-
An id for the Item
- Type
- Default
- auto-generated
- Optional
- Yes
- itemTemplate
-
Specification for templating HTML of the this Item
- Type
- | glow.dom.NodeList |
- Optional
- Yes
Overrides any template specified at Track or Timetable level.
- If a String is provided, it is passed through glow.lang.interpolate, with the Item as the other parameter, and the output is used.
- If a NodeList is provided it is used directly.
- If a function is provided it should take the Item as its only argument, and return the HTML or a NodeList to use.
Returns
glow.widgets.Item
The created Item.
Example
// on a numeric Timetable (1 - 100) var myItem = myTrack.addItem("Some Item", 10, 14);
-
Gets the actual content of if the Track footer (if any) for the Timetable to display
Synopsis
myTrack.getFooter();
Returns
glow.dom.NodeList
- getHeader
-
Gets the actual content of if the Track header (if any) for the Timetable to display
Synopsis
myTrack.getHeader();
Returns
glow.dom.NodeList
- indexAt
-
Finds the Item that is on the Track at the given point, and returns it's index in the items[] property
Synopsis
myTrack.indexAt(point);
Parameters
- point
-
- Type
- |
The point on the Track to inspect
Returns
Example
var nowIndex = myTrack.indexAt(new Date()); var now = myTrack.items[nowIndex]; var next = myTrack.items[nowIndex + 1];
- indicesAt
-
Finds any Items that are on the Track at the given point, and returns an array of their indices in the items[] property
Synopsis
myTrack.indicesAt(point);
Parameters
- point
-
- Type
- |
The point on the Track to inspect
Returns
Description
Items appear in the array in "choronological" order
Example
var someIndexes = myTrack.indicesAt("31 December 1999 23:59"); // someIndexes now holds a reference to an Array of integers
- indicesInRange
-
Finds any Items that are on the Track overlapping the given range, and returns an array of their indices in the items[] property
Synopsis
myTrack.indicesInRange(start, end);
Parameters
- start
-
- Type
- |
The start point of the portion of the Track to inspect
- end
-
- Type
- |
The end point of the portion of the Track to inspect
Returns
Description
Items appear in the array in "choronological" order
Example
var someIndexes = myTrack.indicesInRange("31 December 1999 23:59", "1 January 2000 00:01"); // someIndexes now holds a reference to an Array of integers
- itemAt
-
Returns the Item that is on the Track at the given point
Synopsis
myTrack.itemAt(point);
Parameters
- point
-
- Type
- |
The point on the Track to inspect
Returns
Item
Example
var anItem = myTrack.itemAt("31 December 1999 23:59"); // anItem now holds a reference to a glow.Timetable.Item
- itemsAt
-
Returns an array of any Items that are on the Track at the given point
Synopsis
myTrack.itemsAt(point);
Parameters
- point
-
- Type
- |
The point on the Track to inspect
Returns
Item[]
Description
Items appear in the array in "choronological" order
Example
var someItems = myTrack.itemsAt("31 December 1999 23:59"); // someItems now holds a reference to an Array of glow.Timetable.Items
- itemsInRange
-
Returns an array of any Items that are on the Track overlapping the given range
Synopsis
myTrack.itemsInRange(start, end);
Parameters
- start
-
- Type
- |
The start point of the portion of the Track to inspect
- end
-
- Type
- |
The end point of the portion of the Track to inspect
Returns
Item[]
Description
Items appear in the array in "choronological" order
Example
var someItems = myTrack.itemsInRange("31 December 1999 23:59", "1 January 2000 00:01"); // someItems now holds a reference to an Array of glow.Timetable.Items
- setItemTemplate
-
Sets the Default Item template for this track
Synopsis
myTrack.setItemTemplate(template);
Parameters
- template
-
- Type
- | glow.dom.NodeList | function
The template to use
Returns
this
Description
The item will be passed into the template.
Further Info & Examples
-
Sets the footer template for this track
Synopsis
myTrack.setTrackFooterTemplate(template);
Parameters
- template
-
- Type
- | glow.dom.NodeList | function
The template to use
Returns
this
Description
The track will be passed into the template.
Further Info & Examples
- setTrackHeaderTemplate
-
Sets the header template for this track
Synopsis
myTrack.setTrackHeaderTemplate(template);
Parameters
- template
-
- Type
- | glow.dom.NodeList | function
The template to use
Returns
this
Description
The track will be passed into the template.
Further Info & Examples