Skip to main content
Participating Frequently
October 6, 2009
Question

CFTREE document link

  • October 6, 2009
  • 1 reply
  • 505 views

I have built a <cftree> object that is populated from a query and contains links to documents. At the lowest level of the tree, is a URL link to the document. The link is a field from the query. I am having a few challenges in getting this to work properly:

  1. I would like the link to open a new window to display the Word document. To achieve this I am setting the target="_self". This works fine, but when the window opens, the URL is corrupted with the query string "?" at the end of the URL. (i.e.  www.myurl/mydocument.doc?) I have set the appendkey="no", which removes the node reference, but leaves the "?" on the end. If this was a true URL, it woud be fine, but since it references a document, the link fails. Is there a way to remove the question mark?
  2. I would like the link to show up as a hyperlink in the tree. To try to achieve this I have set highlighthref="yes". I thought this would do the trick, but i still get no hyperlink text style and no hand cursor. It does function as a link though, the user just has no indication that it is in fact, a link.
  3. Finally, I am getting mutiple returns of one of my nodes in the tree. It has 4 child nodes and it is coming back twice with two child nodes under each iteration. Any idea what is causing this?

Here is my code:

        <cfform name="treeForm" format="flash" timeout="500" height="310">
            <cftree name="ProfilesTree" height="300" width="515" highlighthref="yes" appendkey="no">
                <cftreeitem value="0" display="Select Location" expand="yes" img="folder">
                <cfset CurGroup1 = "">
                <cfloop query="getProfiles">
                    <cfif CurGroup1 is not ParentLocation>
                        <cftreeitem value="#ParentLocation#" parent="0" display="#ParentLocation#" img="folder" expand="no">
                        <cfset CurGroup1 = ParentLocation>
                        <cfset CurGroup2 = "">
                    </cfif>
                    <cfif CurGroup2 is not BriefName>
                        <cftreeitem value="#BriefName#" parent="#ParentLocation#" display="#BriefName#" img="folder" expand="no">
                        <cfset CurGroup2 = BriefName>
                        <cfset CurGroup3 = "">
                    </cfif>
                    <cfif CurGroup3 is not RoleName>
                        <cftreeitem value="#RoleName#" parent="#BriefName#" display="#RoleName#" img="document" expand="no" href="#documents#HardwareProfiles/#Link#" target="_self">
                        <cfset CurGroup3 = RoleName>
                    </cfif>
                </cfloop>
            </cftree>
        </cfform>

Thanks for any help.

    This topic has been closed for replies.

    1 reply

    R0bert!Author
    Participating Frequently
    October 6, 2009

            <cfform name="treeForm" format="flash" timeout="500" height="310">
                <cftree name="ProfilesTree" height="300" width="515" highlighthref="yes" appendkey="no">
                    <cftreeitem value="0" display="Select Location" expand="yes" img="folder">
                    <cfset CurGroup1 = "">
                    <cfloop query="getProfiles">
                        <cfif CurGroup1 is not ParentLocation>
                            <cftreeitem value="#ParentLocation#" parent="0" display="#ParentLocation#" img="folder" expand="no">
                            <cfset CurGroup1 = ParentLocation>
                            <cfset CurGroup2 = "">
                        </cfif>
                        <cfif CurGroup2 is not BriefName>
                            <cftreeitem value="#BriefName#" parent="#ParentLocation#" display="#BriefName#" img="folder" expand="no">
                            <cfset CurGroup2 = BriefName>
                            <cfset CurGroup3 = "">
                        </cfif>
                        <cfif CurGroup3 is not RoleName>
                            <cftreeitem value="#RoleName#" parent="#BriefName#" display="#RoleName#" img="document" expand="no" href="#documents#HardwareProfiles/#Link#" target="_self">
                            <cfset CurGroup3 = RoleName>
                        </cfif>
                    </cfloop>
                </cftree>
            </cfform>