Datapaths are used to merge data hierarchies with the hierarchy of an
OpenLaszlo application. This is done using the the XPath syntax supported
lz.datapointer. When a node is given a
datapath attribute, a datapath with
the given value as its XPath is created. If the datapath retrieves a
node (i.e. it doesn't terminate in an attribute getter or a
() operator) then the node is mapped to that data context
and all child nodes will implicitly share the datacontext, but no
further action is taken. If the datapath retrieves data, rather than
just a node, a few extra things happen. First, the node's
data property is set and the node's
ondata event is sent. Second, the node's
applyData method is called with the data as the
argument. In cases where a datapath matches more than one data node,
the view with the matching datapath is replicated once for each data
node that matches, and a lz.ReplicationManager takes over
the view's spot in its parent.
When a node is replicated, an LzReplicationManager takes it's place,
onclones will be sent when the node's clones are updated.
A node can only have one datapath, and datapaths always have the name
datapath. Additional options available on datapath such
as pooling and
replication are specified
by writing the
<datapath> tag as a separate node.
Example 23. Mapping data to views using datapaths
Clear and Cold</
|Name||Type (tag)||Type (js)||Default||Category|
|This attribute applies to datapaths which match multiple nodes and force replication. If pooling is true, views that are data-bound to this datapath are recycled if the dataset changes. Otherwise, views are deleted when the data nodes they are bound to disappear, and created when new data nodes match the datapath. See the section on Pooling in the Guide for information about the use of this attribute.|
||'normal' | 'lazy' | 'resize'||String||'normal'||initialize-only|
|Determines whether to use normal or lazy replication, if the
datapath matches more than one node.
See the section on Replication
in the Guide for information about the use of this attribute.
|The order to use to sort the dataset if replication occurs. One of
|An XPath to use to obtain the sort key for sorting if replication
occurs. To change this attribute, use
xpathends in a terminal selector (an attribute,
name()expression), then the datapath attempts to call its parent's
updateDatamethod. If this method returns a non-undefined value, the datapath sets the data element's attribute, text, or name, respectively, to
updateData's return value. The method then calls any other
updateDataon any datapaths which depend on this one for context. In short, to make datamapping work both ways for a given UI control, define a
updateDatamethod that returns the value for the data mapped to the node. This is already done for the base
LzInputTextclass, but not for any other LFC classes.
addNode, addNodeFromPointer, comparePointer, deleteNode, deleteNodeAttribute, dupePointer, getDataset, getNodeAttribute, getNodeAttributes, getNodeCount, getNodeName, getNodeOffset, getNodeText, getNodeType, getXPathIndex, isValid, LzDatapointer, selectChild, selectNext, selectParent, selectPrev, serialize, setFromPointer, setNodeAttribute, setNodeName, setNodeText, setPointer, setXPath, xpathQuery
animate, applyConstraint, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setData, setDatapath, setOption, setSelected, updateData
Copyright © 2002-2008 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.