new StaticGrid(id, autoParse, rootEl, cells)
Creates an object that extends AbstractGrid displaying its values
in a grid made of HTML elements. The grid rows are displayed into statically
prepared HTML rows. The object can be supplied to
Subscription#addListener and Subscription#removeListener
in order to display data from one or more Subscriptions.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | An identification string to be specified in the HTML element as the data "data-grid" property value to make it possible for this StaticGrid instance to recognize its cells. The binding between the cells and the StaticGrid is performed during the AbstractGrid#parseHtml execution. |
autoParse |
boolean | If true the AbstractGrid#parseHtml method is executed before the constructor execution is completed. If false the parseHtml method has to be called later by custom code. It can be useful to set this flag to false if, at the time of the StaticGrid instance creation, the HTML elements designated as cells are not yet ready on the page. |
rootEl |
DOMElement | if specified, the cells to make up the HTML grid will only be searched in the list of descendants of this node. Equivalent to a StaticGrid#setRootNode call, but useful if autoParse is true. |
cells |
Array | an array of DOMElement instances that will make up the HTML grid for this StaticGrid instance. If specified and not empty, the parseHtml method will avoid searching cells in the DOM of the page. Equivalent to multiple StaticGrid#addCell calls, but also useful if autoParse is true. |
Extends
Method Summary
- addCell
- Operation method that adds an HTML cell pointer to the StaticGrid.
- addListener
- Adds a listener that will receive events from the StaticGrid instance.
- extractItemList
- Creates an array containing all of the unique values of the "data-item" properties in all of the HTML elements associated to this grid during the AbstractGrid#parseHtml execution.
- getListeners
- Returns an array containing the StaticGridListener instances that were added to this client.
- removeListener
- Removes a listener from the StaticGrid instance so that it will not receive events anymore.
- setRootNode
- Setter method that specifies the root node to be used when searching for grid cells.
Inherited Methods
|
clean |
extractCommandSecondLevelFieldList |
extractFieldList |
forceSubscriptionInterpretation |
getNodeTypes |
getSortField |
getValue |
isAddOnTop |
isCommaAsDecimalSeparator |
isDescendingSort |
isHtmlInterpretationEnabled |
isNumericSort |
onClearSnapshot |
onCommandSecondLevelItemLostUpdates |
onCommandSecondLevelSubscriptionError |
onEndOfSnapshot |
onItemLostUpdates |
onItemUpdate |
onListenEnd |
onListenStart |
onSubscription |
onSubscriptionError |
onUnsubscription |
removeRow |
setAddOnTop |
setAutoCleanBehavior |
setHtmlInterpretationEnabled |
setNodeTypes |
setSort |
updateRow |
Method Detail
-
addCell(cellElement)
-
Operation method that adds an HTML cell pointer to the StaticGrid.
Note that if at least one cell is manually specified then the AbstractGrid#parseHtml will not perform any search in the DOM of the page and will only use the given cells.Lifecycle: Cell pointers can be added to a StaticGrid at any time. However, before an HTML element is actually used as a cell by the StaticGrid a call to AbstractGrid#parseHtml is necessary.
Parameters:
Name Type Description cellElement
DOMElement A DOM pointer to an HTML node. The specified HTML node should be a "legal" cell for the StaticGrid (i.e. should be defined according with the requirements for the StaticGrid as described in the overview of this class). Moreover, nodes of any types are allowed. -
addListener(listener)
-
Adds a listener that will receive events from the StaticGrid instance.
The same listener can be added to several different StaticGrid instances.Lifecycle: a listener can be added at any time.
Parameters:
Name Type Description listener
StaticGridListener An object that will receive the events as shown in the StaticGridListener interface.
Note that the given instance does not have to implement all of the methods of the StaticGridListener interface. In fact it may also implement none of the interface methods and still be considered a valid listener. In the latter case it will obviously receive no events. -
extractItemList() → {Array}
-
Creates an array containing all of the unique values of the "data-item" properties in all of the HTML elements associated to this grid during the AbstractGrid#parseHtml execution. The result of this method is supposed to be used as "Item List" of a Subscription.
Execution of this method is pointless if HTML elements associated to this grid through "data-item" specify an item position instead of an item name.Returns:
The list of unique values found in the "data-item" properties of HTML element of this grid.- Type
- Array
-
getListeners() → {Array}
-
Returns an array containing the StaticGridListener instances that were added to this client.
Returns:
an array containing the listeners that were added to this instance. Listeners added multiple times are included multiple times in the array.- Type
- Array
-
removeListener(listener)
-
Removes a listener from the StaticGrid instance so that it will not receive events anymore.
Lifecycle: a listener can be removed at any time.
Parameters:
Name Type Description listener
StaticGridListener The listener to be removed. -
setRootNode(rootNode)
-
Setter method that specifies the root node to be used when searching for grid cells. If specified, only descendants of the supplied node will be checked.
Anyway note that if nodes are explicitly set through the constructor or through the StaticGrid#addCell method, then the search will not be performed at all.Default value: the entire document.
Lifecycle: a root node can be specified at any time. However, before a new search is performed for the StaticGrid a call to AbstractGrid#parseHtml is necessary.
Parameters:
Name Type Description rootNode
DOMElement a DOM node to be used as starting point when searching for grid cells.