Organigram"

From Documentation
Line 48: Line 48:
 
= Model-Driven Display =
 
= Model-Driven Display =
 
[[Image:Organigram example2.png]]
 
[[Image:Organigram example2.png]]
<source language="xml">
+
<source lang="xml">
 
<zscript><![CDATA[
 
<zscript><![CDATA[
 
DefaultTreeNode root = new DefaultTreeNode(null, new DefaultTreeNode[]{
 
DefaultTreeNode root = new DefaultTreeNode(null, new DefaultTreeNode[]{
Line 64: Line 64:
 
= Selection =
 
= Selection =
  
<tt>Organigram</tt> supports single selection, Orgitem can be selected by users clicking or by programing:
+
<tt>Organigram</tt> supports single selection, Orgitem can be selected by users clicking or by programming:
  
 
<javadoc method="setSelectedItem(org.zkoss.zkmax.zul.Orgitem)">org.zkoss.zkmax.zul.Organigram</javadoc> , <javadoc method="setSelected(java.lang.Boolean)">org.zkoss.zkmax.zul.Orgitem</javadoc>.
 
<javadoc method="setSelectedItem(org.zkoss.zkmax.zul.Orgitem)">org.zkoss.zkmax.zul.Organigram</javadoc> , <javadoc method="setSelected(java.lang.Boolean)">org.zkoss.zkmax.zul.Orgitem</javadoc>.
Line 73: Line 73:
  
 
[[Image:Organigram selection.png]]
 
[[Image:Organigram selection.png]]
<source language="xml">
+
<source lang="xml">
 
<organigram width="600px" onSelect="Clients.log(self.getSelectedItem().getLabel())">
 
<organigram width="600px" onSelect="Clients.log(self.getSelectedItem().getLabel())">
 
<orgchildren>
 
<orgchildren>

Revision as of 01:54, 22 September 2021

Organigram

  • Available for ZK:
  • http://www.zkoss.org/product/zkhttp://www.zkoss.org/whyzk/zkeeVersion ee.png

Since 8.6.0

Employment/Purpose

Organigram is a component for showing organizational chart by using tree data structure, it also support TreeModel to hold data, Organigram only accept one Orgchildren as child, developers can put Orgchildren, Orgitem and Orgnode in Organigram to display data.

Organigram supports Client Render on Demand

Browser Support

  • For IE, this component only supports 11+, it is based on CSS Flexbox, please check browser compatibility before using it.

Example

Organigram example.png

	<organigram width="600px">
		<orgchildren>
			<orgitem label="Item1">
				<orgchildren>
					<orgitem label="Item2">
						<orgchildren>
							<orgitem label="Item3"/>
							<orgitem label="Item4">
								<orgchildren>
									<orgitem label="Item5"/>
								</orgchildren>
							</orgitem>
						</orgchildren>
					</orgitem>
					<orgitem label="Item6">
						<orgchildren>
							<orgitem label="Item7"/>
							<orgitem label="Item8"/>
						</orgchildren>
					</orgitem>
				</orgchildren>
			</orgitem>
		</orgchildren>
	</organigram>

Model-Driven Display

Organigram example2.png

	<zscript><![CDATA[
		DefaultTreeNode root = new DefaultTreeNode(null, new DefaultTreeNode[]{
			new DefaultTreeNode("Item1", new DefaultTreeNode[]{
				new DefaultTreeNode("Item2"), new DefaultTreeNode("Item3"), new DefaultTreeNode("Item4")
			})
		});
		DefaultTreeModel model = new DefaultTreeModel(root);
		model.addOpenPath(new int[]{0});
	]]></zscript>
	<organigram width="600px" model="${model}"/>


Selection

Organigram supports single selection, Orgitem can be selected by users clicking or by programming:

Organigram.setSelectedItem(Orgitem) , Orgitem.setSelected(Boolean).

When an Orgitem is selected, the onSelect event will sent back to the server to notify the application, you can call Organigram.getSelectedItem() to get the selected Orgitem.

Example:

Organigram selection.png

	<organigram width="600px" onSelect="Clients.log(self.getSelectedItem().getLabel())">
		<orgchildren>
			<orgitem label="Item1">
				<orgchildren>
					<orgitem label="Item2"/>
					<orgitem label="Item3" selected="true"/>
					<orgitem label="Item4"/>
				</orgchildren>
			</orgitem>
		</orgchildren>
	</organigram>


Custom Orgitem

you can also render Organigram with your customized Renderer and Template, please refer to:

Organigram Template

Organigram Renderer


Supported Events

Name
Event Type
onSelect
Event: SelectEvent

Notifies one that the user has selected a new item in the organigram.


Supported Children

* Orgchildren


Version History

Last Update : 2021/09/22


Version Date Content
     



Last Update : 2021/09/22

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.