Logic Tags
Tag replacehierdata


This tag is used to create or modify hierarchical data by replacing child nodes with new data collection.Use appendhierdata tag to create new children or append data to existing children.The example below replaces children of "topCommunities" at location 0,2 with the data in "communityPages" tag variable. If topCommunities contains a list of communities and their Subcommunities and "communityPages" contains a list of Community pages, the tag replaces existing Community Pages in the 3rd Subcommunity (2 is the 3rd element in 0 based index) of the first top level Community. In the example, the pt:childkey attribute specifies that you are inserting data to Community Pages; this attribute is not needed when inserting a list of subcommunities, because that is the default child type for Communities.

Example:
<pt:logic.replacehierdata pt:id="topCommunities" pt:dataid="communityPages" pt:index="0,2" pt:childkey="commpages" />
// replace children of the second top level parent
<pt:logic.replacehierdata pt:id="topCommunities" pt:dataid="communityPages" pt:index="1" pt:childkey="commpages" />


Tag Information
Tag Namereplacehierdata

Attributes
NameTypeRequiredDefault ValueDescription
datastringtruenullName of tag variable that contains data with which to replace the target data.
datascopestringfalseportlet requestScope of the data tag variable id.
targetstringtruenullName of the target tag variable.
scopestringfalseportlet requestScope of the target tag variable.
indexstringtruenullComma separated list of numbers specifying the position in the hierarchical data structure at which to replace the data. The first number specifies index in the top list, and each following number index in lower level lists. 0 represents the first element of a list. A value of '2,0,12' inserts data into 3rd entry in the top list, first entry in the second list and 13th entry in the 3rd level list.
Examples:
"0" - Insert data list as children to the first top level entry
"1,3" - Inserth children as the 4th child object of the 2nd top level data object
childkeystringfalsechildrenHierarchical data key if different from the default 'children'. For example, used when adding Community Pages children to Communities.


Copyright 2005 Plumtree Software, Inc.