1 <div class="apiDetail">
\r
3 <h2><span>Function(treeId, treeNode)</span><span class="path">setting.view.</span>addDiyDom</h2>
\r
4 <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
\r
7 <div class="longdesc">
\r
8 <p>This function used to display the custom control on the node.</p>
\r
9 <p class="highlight_red">1. If you have huge node data, please note: this function will affect the initialization performance. If not required, it is recommended not to use this function.</p>
\r
10 <p class="highlight_red">2. This function is an advanced application, please make sure that a better understanding of zTree before you use it.</p>
\r
11 <p>Default: null</p>
\r
14 <h3>Function Parameter Descriptions</h3>
\r
16 <h4><b>treeId</b><span>String</span></h4>
\r
17 <p>zTree unique identifier: <b class="highlight_red">treeId</b>, easy for users to control.</p>
\r
18 <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
\r
19 <p>JSON data object of the node which display the custom control.</p>
\r
21 <h3>Examples of setting & function</h3>
\r
22 <h4>1. Display button in all nodes.</h4>
\r
23 <pre xmlns=""><code>var setting = {
\r
25 addDiyDom: addDiyDom
\r
28 function addDiyDom(treeId, treeNode) {
\r
29 var aObj = $("#" + treeNode.tId + "_a");
\r
30 if ($("#diyBtn_"+treeNode.id).length>0) return;
\r
31 var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
\r
32 + "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
\r
33 + "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
\r
34 aObj.append(editStr);
\r
35 var btn = $("#diyBtn_"+treeNode.id);
\r
36 if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
\r