You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
4.5 KiB
142 lines
4.5 KiB
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
|
|
Trees
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
|
|
|
<%=Html.QPEdit() %>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
<div style="margin:10px;">
|
|
<a href="#" onclick="reload()">reload</a>
|
|
<a href="#" onclick="getChildren()">getChildren</a>
|
|
<a href="#" onclick="getChecked()">getChecked</a>
|
|
<a href="#" onclick="getSelected()">getSelected</a>
|
|
<a href="#" onclick="collapse()">collapse</a>
|
|
<a href="#" onclick="expand()">expand</a>
|
|
<a href="#" onclick="collapseAll()">collapseAll</a>
|
|
<a href="#" onclick="expandAll()">expandAll</a>
|
|
<a href="#" onclick="append()">append</a>
|
|
<a href="#" onclick="remove()">remove</a>
|
|
<a href="#" onclick="update()">update</a>
|
|
<a href="#" onclick="isLeaf()">isLeaf</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><%=Html.QTreeView("systemLimitMeun", "/Examples/GetTreeData")%></td>
|
|
</tr>
|
|
</table>
|
|
<%=Html.QPEnd() %>
|
|
<%=Html.Hidden("selectKey") %>
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
|
|
|
|
<%=Html.QTButtonSave("Examples", "SaveTree", "Save()")%>
|
|
<script type="text/javascript" language="javascript">
|
|
function Save() {
|
|
var ids = getTreeID();
|
|
if (ids == "") {
|
|
MSI("", "请选择要设置的权限");
|
|
return;
|
|
}
|
|
document.getElementById("selectKey").value = ids;
|
|
submitByButton("SaveTree");
|
|
}
|
|
|
|
function reload() {
|
|
|
|
$('#systemLimitMeun').tree('reload');
|
|
|
|
}
|
|
function getChildren() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
if (node) {
|
|
var children = $('#systemLimitMeun').tree('getChildren', node.target);
|
|
} else {
|
|
var children = $('#systemLimitMeun').tree('getChildren');
|
|
}
|
|
var s = '';
|
|
for (var i = 0; i < children.length; i++) {
|
|
s += children[i].text + ',';
|
|
}
|
|
alert(s);
|
|
}
|
|
function getChecked() {
|
|
var nodes = $('#systemLimitMeun').tree('getChecked');
|
|
var s = '';
|
|
for (var i = 0; i < nodes.length; i++) {
|
|
if (s != '') s += ',';
|
|
s += nodes[i].text;
|
|
}
|
|
alert(s);
|
|
}
|
|
function getSelected() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
alert(node.text);
|
|
}
|
|
function collapse() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
$('#systemLimitMeun').tree('collapse', node.target);
|
|
}
|
|
function expand() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
$('#systemLimitMeun').tree('expand', node.target);
|
|
}
|
|
function collapseAll() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
if (node) {
|
|
$('#systemLimitMeun').tree('collapseAll', node.target);
|
|
} else {
|
|
$('#systemLimitMeun').tree('collapseAll');
|
|
}
|
|
}
|
|
function expandAll() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
if (node) {
|
|
$('#systemLimitMeun').tree('expandAll', node.target);
|
|
} else {
|
|
$('#systemLimitMeun').tree('expandAll');
|
|
}
|
|
}
|
|
function append() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
$('#systemLimitMeun').tree('append', {
|
|
parent: (node ? node.target : null),
|
|
data: [{
|
|
text: 'new1',
|
|
checked: true
|
|
}, {
|
|
text: 'new2',
|
|
state: 'closed',
|
|
children: [{
|
|
text: 'subnew1'
|
|
}, {
|
|
text: 'subnew2'
|
|
}]
|
|
}]
|
|
});
|
|
}
|
|
function remove() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
$('#systemLimitMeun').tree('remove', node.target);
|
|
}
|
|
function update() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
if (node) {
|
|
node.text = '<span style="font-weight:bold">new text</span>';
|
|
node.iconCls = 'icon-save';
|
|
$('#systemLimitMeun').tree('update', node);
|
|
}
|
|
}
|
|
function isLeaf() {
|
|
var node = $('#systemLimitMeun').tree('getSelected');
|
|
var b = $('#systemLimitMeun').tree('isLeaf', node.target);
|
|
alert(b)
|
|
}
|
|
</script>
|
|
</asp:Content>
|
|
|