summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/thirdparty/zTree/api/en/setting.callback.onClick.html
blob: 0453af85a3fbfa3b2319a9d3ea2a03c265bf93a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<div class="apiDetail">
<div>
	<h2><span>Function(event, treeId, treeNode, clickFlag)</span><span class="path">setting.callback.</span>onClick</h2>
	<h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
	<div class="desc">
		<p></p>
		<div class="longdesc">
			<p>Used to capture the click event when click node.</p>
			<p class="highlight_red">If you set 'setting.callback.beforeClick',and return false, zTree will not change selected state, and will not trigger the 'onClick' callback.</p>
			<p>Default: null</p>
		</div>
	</div>
	<h3>Function Parameter Descriptions</h3>
	<div class="desc">
	<h4><b>event</b><span>js event Object</span></h4>
	<p>event Object</p>
	<h4 class="topLine"><b>treeId</b><span>String</span></h4>
	<p>zTree unique identifier: <b class="highlight_red">treeId</b>, easy for users to control.</p>
	<h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
	<p>JSON data object of the node which is clicked</p>
	<h4 class="topLine"><b>clickFlag</b><span>Number</span></h4>
	<p>Node is selected or deselected state, please see table below for details</p>
	<table width="100%" border="0" cellspacing="1" cellpadding="0">
		<thead><tr><td>clickFlag</td><td title="Whether to allow multi-select">selectedMulti</td><td title="Whether to press Ctrl-key or Cmd-key">autoCancelSelected<br/>&&<br/>event.ctrlKey / metaKey</td><td title="Node's selection state">isSelected</td><td>operate for selected</td></tr></thead>
		<tbody>
			<tr><td>1</td><td>true</td><td>false</td><td>false</td><td>node is selected (single)</td></tr>
			<tr><td>1</td><td>true</td><td>false</td><td>true</td><td>node is selected (single)</td></tr>
			<tr><td>2</td><td>true</td><td>true</td><td>false</td><td>node is selected (multi)</td></tr>
			<tr><td>0</td><td>true</td><td>true</td><td>true</td><td>node is deselected</td></tr>
			<tr><td>1</td><td>false</td><td>false</td><td>false</td><td>node is selected (single)</td></tr>
			<tr><td>1</td><td>false</td><td>false</td><td>true</td><td>node is selected (single)</td></tr>
			<tr><td>1</td><td>false</td><td>true</td><td>false</td><td>node is selected (single)</td></tr>
			<tr><td>0</td><td>false</td><td>true</td><td>true</td><td>node is deselected</td></tr>
		</tbody>
	</table>
	</div>
	<h3>Examples of setting & function</h3>
	<h4>1. When click node, alert info about 'tId' and 'name'.</h4>
	<pre xmlns=""><code>function zTreeOnClick(event, treeId, treeNode) {
    alert(treeNode.tId + ", " + treeNode.name);
};
var setting = {
	callback: {
		onClick: zTreeOnClick
	}
};
......</code></pre>
</div>
</div>