12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Trees7.4.2.1 <strong>Using</strong> a GlobalThe simplest way to define a is to use a Caché global (multidimensional array). For background informationabout globals, refer to the book <strong>Using</strong> Caché Globals.The following definition references the ^myTree global by providing the dataGlobal attribute:This definition causes the contents of the ^myTree global to be displayed on the page as nodes within an expandable tree.Node LabelsSuppose you define ^myTree using the following statements at the Terminal command line:Set ^myTree("Root","Item 1") = "ZENMVC.MVCForm.cls"Set ^myTree("Root","Item 2") = "http://www.intersystems.com"Set ^myTree("Root","Item 2","SubItem") = "ZENDemo.Home.cls"Each global node now has one or more subscripts, such as "Root" or "Item 2". <strong>Zen</strong> uses these subscripts as the displayvalues for nodes in the . The logical value for each node is the value of the global at that subscript. Our ^myTreeglobal can now generate a that looks like the following illustration. This is fully expanded, withthe user holding the cursor over the node "SubItem" at the lowest level. Based on the previous SET statements, the logicalvalue for this node is "ZENDemo.Home.cls" and its display value is "SubItem"Important:When you use a global to define a , the resulting nodes always appear in alphabetical order(by label) because that is the way globals are organized in the database.Node ValuesWhen the user clicks on a node label such as:"SubItem"The corresponding node value is triggered. If the values are set as described in the “Node Labels” section of this chapter,then this value is:"ZENDemo.Home.cls"Each node value is a string. Typically the node values are URI values. For example:• The name of a <strong>Zen</strong> page class:"ZENMVC.MVCForm.cls"• A Web site:"http://www.intersystems.com"• Or the URI of some other content.If you want a link to invoke JavaScript, you can start the URI with the string javascript: as in the following examples:• You can invoke a client-side JavaScript method in the page class:"javascript: zenPage.myMethod();"<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 209

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!