|
<%@ Page language= "C #" autoeventwireup= true "codebehind=" WebForm1.aspx.cs "inherits=" at. Web.webform1 "%>
<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>ztree Tree-shape Example </title>
<link href= "Themes/styles/ztreestyle/ztreestyle.css" rel= "stylesheet"/>
<script src= "Themes/scripts/jquery-1.8.2.min.js" type= "Text/javascript" ></script>
<script src= "Themes/scripts/artdialog/artdialog.source.js" type= "Text/javascript" ></script>
<script src= "Themes/scripts/artdialog/iframetools.source.js" type= "Text/javascript" ></script>
<script src= "Themes/scripts/functionjs.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >
</script>
<script src= "Themes/scripts/jquery.ztree.core-3.5.min.js" ></script>
<script type= "Text/javascript" >
var znodes;
var Ztree;
Setting settings for asynchronous loading
var setting = {
Async: {
Enable:true,//means the asynchronous load takes effect
URL: "Ajax/regiondata.aspx",//page accessed when loading asynchronously
Autoparam: ["id"],//The parameter of the parent node property that is automatically committed at the time of loading
Otherparam: ["Ajaxmethod", ' Ansydata '], parameters submitted upon request//ajax
Type: ' Post ',
DataType: ' JSON '
},
Checkable:true,
Showicon:true,
Showline:true,//ztree display cable
Data: {//PID to identify parent-child node relationships
Simpledata: {
Enable:true
}
},
Expandspeed: "",//Set Ztree node expand, collapse animation speed, default to "Fast", "" means no animation
Callback: {//callback function
Onclick:ztreeonclick,/Click the mouse event
Asyncsuccess:ztreeonasyncsuccess//Asynchronous Load Success Events
}
};
$ (document). Ready (function () {
Initregion ();
$.fn.ztree.init ($ ("#treeDemo"), setting, znodes);
});
Initializing load Nodes
function Initregion () {
$.ajax ({
URL: ' ajax/regiondata.aspx ',
Type: ' Post ',
DataType: ' JSON ',
Async:false,
Data: {' Ajaxmethod ': ' Firstansydata '},
Success:function (data) {
Znodes = data;
}
});
};
Gets the ID of the Ztree node when clicked, and values of value
function Ztreeonclick (event, Treeid, TreeNode, Clickflag) {
var treevalue = treenode.id + "," + treenode.name;
Click to assign a value to a text box
var Id = treenode.pid;
var v = "";
if (Id = = ' ' | | Id = = Undefined | | Id = = null) {
v = treenode.name + "-Parent section";
}
else {
v = treenode.name + "-sub-section";
}
Top. role_form.get_region_id (Treenode.id, v);
Double-click to close the pop-up box
OpenClose ();
Alert (v + "," + treenode.name);
};
function Ztreeonasyncsuccess (event, Treeid, TreeNode, msg) {
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<ul id= "Treedemo" class= "Ztree" ></ul>
</form>
</body>
|