The pt:standard.tree and pt:standard.treelink tags create a form button or link to a popup window that allows users to select options from a structured list of objects. The pt:standard.treeurl tag returns a URL that can be used in JavaScript. (In previous versions, these tags were implemented as pt:tree and pt:treeLink. This syntax is still supported.) These tags are only supported in the ALI portal.
These tags have a selection of attributes that control the tree display. Required attributes are marked with an asterisk (*).
|
Attribute |
Description |
Default |
Syntax |
|
*pt:Class |
The ID of the types of objects to display in the tree. (See the table under pt:openerLink for a list of Class IDs. Community pages are not supported.) (REQUIRED) |
value required |
pt:Class='<classID1>,<classID2>,<classID3>,...' |
|
*pt:RootID |
The ID of the root folder to be displayed in the tree. Use ID 1 for all folders. (REQUIRED) |
value required |
pt:RootID='<folderID>' |
|
*pt:SubmitMd |
The mode in which the tree submits data to the opening page. Use mode 2 (javascript submit for remote development). When the data is submitted, the javascript function defined in pt:Submit is called on the main page. (REQUIRED) |
value required (=2) |
pt:SubmitMd='2' |
|
*pt:Submit |
The name of the javascript function in the parent page to call when the tree is submitted (can take in an array of objects with name, Object ID, and Class ID). Do not include parentheses ("()") in the value of this attribute. (REQUIRED) |
value required |
pt:Submit='<javascriptFunctionName>' |
|
Optional Attributes |
|||
|
pt:AllowEmpty |
Allows users to click finish in a tree window
with nothing selected: |
false |
pt:AllowEmpty='true' or pt:AllowEmpty='false' |
|
pt:Display |
Limits the display to the selected objects,
referenced by Class ID and Object ID. Cannot be used to display folders.
The Class ID of each object must be included in pt:Class.
The pt:RootID must be specified even though it will be
ignored. |
n/a |
pt:Display='<classID1>,<objectID1>,<classID2>,<objectID2>,...' |
|
pt:Form / pt:Input |
Puts the AActivitySpace ID of the tree space
into the target form input (used to reopen the tree after it has been
created). |
n/a |
pt:Form='<formName>' pt:Input='in_hi_parentSpace' |
|
pt:Hide |
Hides the specified objects. (See pt:openerLink for a list of Class IDs.) |
n/a |
pt:Hide='<classID1>,<objectID1>,<classID2>,<objectID2>,...' |
|
pt:Multi |
Allows users to select multiple items: |
false |
pt:Multi='true' or pt:Multi='false' |
|
pt:Select |
The default selected item(s) in the tree, referenced by Class ID and Object ID. (See pt:openerLink for a list of Class IDs.) |
none |
pt:Select='<classID1>,<objectID1>,<classID2>,<objectID2>,...' |
|
pt:SelectMd |
The tree select mode: 1=compositeselect, 2=leafselect,
3=leafcompositeselect |
2 |
pt:SelectMd='<modeID>' |
|
pt:ShowRoot |
Allows you to hide the root folder: |
true |
pt:ShowRoot='true' or pt:ShowRoot='false' |
|
pt:SubTitle |
Subtitle of the tree, for user instruction (e.g., "Choose a user.") |
none |
pt:SubTitle='<windowSubtitle>' |
|
pt:Title |
Title of the tree popup window. |
none |
pt:Title='<windowTitle>' |
|
pt:windowFeatures |
Allows you to define the features argument for the resulting window.open() function call, specifying the features for a standard browser window. |
(see syntax) |
pt:windowFeatures='location=no,menubar=no, resizable=yes,height=400,width=400' |
|
pt:windowName |
Window name of the popup tree, used in the resulting window.open() function call. |
'_blank1' |
pt:windowName='<windowName>' |
|
Advanced Attributes |
|||
|
pt:Access |
Access level for the objects to be displayed: |
3 |
pt:Access='<accessLevel>' |
|
pt:CommunityMode / pt:CommunityID |
Specifies whether to include community objects
in the tree: 1=no communities, 2=this community (specified community +
all parent communities), 3=all communities. |
1 |
pt:CommunityMode='<communityMode>' |
|
pt:DirMode |
Specifies which mode to use when selecting
objects from the Knowledge Directory: 1=Browse Mode; 2=Edit Mode |
2 |
pt:DirMode='<dirMode>' |
The following example produces a button with an "onclick" action that opens a popup window (see image below).
<pt:standard.tree xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' value="Button Name" class="gContentSection" pt:windowName='myWindow' pt:windowFeatures='location=no,menubar=no,height=500,width=300' pt:RootID='1' pt:Multi='false' pt:SelectMd='2' pt:SubmitMd='2' pt:Submit='PickerSubmit' pt:Title='User' pt:SubTitle='Pick some user' pt:Class='1'/>
The pt:treeLink tag can be used in the same way, except that it generates an anchor tag instead of a form button. In this tree control, the selection is limited to one user.
<pt:standard.treeLink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:windowName='myWindow' pt:windowFeatures='location=no,menubar=no,height=500,width=300' pt:RootID='1' pt:Multi='false' pt:SelectMd='2' pt:SubmitMd='2' pt:Submit='PickerSubmit' pt:Title='User' pt:SubTitle='Pick some user' pt:Class='1'>Pick the user group</pt:standard.treeLink>
The previous example results in the following link. (As noted above, pt:tree results in a form button.)
<a href="#" onclick="window.open('…', 'myWindow', 'location=no,menubar=no,height=500,width=300');">Pick the user group</a>
Clicking the link or form button opens a popup window that allows you to browse and choose the referenced object type, as shown in the image below.
As noted earlier, this code requires a JavaScript function (named in the pt:Submit attribute) to handle the submission from the tree. The following example takes in an array with name, Object ID, and Class ID. When the pt:Multi attribute is set to false (single selections only), only the first set of declarations is necessary.
function PickerSubmit (myInput)
{
item0Name = myInput[0].Name;
item0ObjectID = myInput[0].ObjectID;
item0ClassID = myInput[0].ClassID;item1Name = myInput[1].Name;
item1ObjectID = myInput[1].ObjectID;
item1ClassID = myInput[1].ClassID;
...
}
In the Company Store, the pt:tree link is used to create a select folder popup window. The selection is limited to one folder.
lblSelectedFolderAction.Text = "<pt:tree class='formEditorBtnText' value='" & LocRM.GetString("txtActionSelectFolder") & "' " & _ pt:Multi='false' pt:SelectMd='1' pt:SubmitMd='2' " & _ pt:Class='17' " & _ pt:RootID='1' & _ "pt:Submit='returnFromFolderSelection' " & _ strSelectedFolder & " " & _ "pt:Title='" & LocRM.GetString("txtLabelFolders") & "' " & _ "pt:SubTitle='" & LocRM.GetString("txtLabelSelectFolder") & "' " & _ "xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' />"
In this case, the JavaScript function on the code-behind page passes the array to a Web Form (EditProductSubmitToPortalCatalog.aspx). The return array is placed into hidden form elements and posted back so that the transformer link can specify which items should be selected if the user opens the dialog box again.
function returnFromFolderSelection(arrIn){
var tmpObject;
var iLength;
iLength = arrIn.length;if (iLength > 0) {
tmpObject = arrIn[0];
document.Form1.HiddenSelectedFolderName.value = tmpObject.Name;
document.Form1.HiddenSelectedFolderObjectID.value = tmpObject.ObjectID;
document.Form1.HiddenSelectedFolderClassID.value = tmpObject.ClassID;
}
document.Form1.submit();
}
For a full list of tags, see the TagDocs.