Link to home
Start Free TrialLog in
Avatar of MedtronicVascSR
MedtronicVascSRFlag for United States of America

asked on

Coldfusion 8 CFTREE Binding And Opening Documents....

Hi,
Got a quick and hopefully easy to answer question. I've put together a very nice dynamic feature using the CFTREE in CF 8, which is bound to a cfc that takes a 3rd variable as the starting point or path. It works like a charm allowing the user to navigate various directories and sub-folders to view the files contained within each. The task I'm trying to solve now is how to allow the user to click on the document they find with this feaure and get it to open up. Since the CFTREE when used with binding only allows the attribute "bind" I can't see how to trigger an event to open the file up. I can place a test button within the CFFORM and view the path value using ColdFusion.getElementValue, but that is not very user friendly. Any direction or suggestions?

Cheers,
Ty
ASKER CERTIFIED SOLUTION
Avatar of stmatth
stmatth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MedtronicVascSR

ASKER

Actually, if you use the "bind" attribute in the CFTREEITEM then all other attributes, including HREF, are not allowed. "A tree is dynamic when the first cftreeitem tag of the tree has a bind attribute associated with it. The tag does not allow the attribute(s) VALUE,EXPAND,IMG,IMGOPEN,HREF,TARGET,QUERYASROOT,QUERY,DISPLAY,PARENT. The only required attribute is bind. "

I think the way this needs to be done is somehow passing back from the cfc file the HREF tag with info, but I'm not sure if this can be done or is the correct way. I haven't had any luck with it.

Cheers,
Ty
<cfform id="myForm_#MyFolderNumber#">
   <cftree name="dirtree_#MyFolderNumber#" height="400" width="200"  format="html">
	<cftreeitem bind="cfc:MyFolder_TAB.MyFolder.getDirEntries({cftreeitempath}, {cftreeitemvalue}, '#varDirPath1##Replace(Path, '+', ' ', 'All')#')">
    </cftree>
</cfform>

Open in new window

Thanks, I figured it out. I placed the HREF attribute in the CFC and passed it back to the tree item when it is a document. Thanks for the direction on this.

Cheers,
Ty
Avatar of stmatth
stmatth

No probs.  You can actually get quite creative with the display parameter of each tree item... essentially treat it like the row of a table.  If you enclose your display code with <td></td> it will behave as a table cell would.